-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsetup.py
96 lines (86 loc) · 3.28 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
from setuptools import find_packages, setup
import urllib.request, urllib.error, urllib.parse
# Pygrib is a dependency of CAMPS and should be installed prior to installing CAMPS
try:
import pygrib
except(ImportError):
raise ImportError('Pygrib is a dependency for CAMPS, please install Pygrib before attempting to install CAMPS')
# Set information about CAMPS
NAME = 'camps'
VERSION = '1.2.0'
# List required packages
required_packages = ['numpy>=1.17.3',
'scipy>=1.3.1',
'pandas>=0.23.4',
'seaborn>=0.9.0',
'PyYAML>=3.13',
'netCDF4>=1.4.2',
'pyproj>=1.9.6',
'metpy>=0.12.0',
'pygrib>=2.0.4',
'matplotlib>=3.1.1']
# Define console scripts
setuptools_extra_kwargs = {
'entry_points': {
'console_scripts': [
'camps_mospred = camps.scripts.mospred_driver:main',
'camps_grib2_to_nc = camps.scripts.grib2_to_nc_driver:main',
'camps_metar_to_nc = camps.scripts.metar_driver:main',
'camps_marine_to_nc = camps.scripts.marine_driver:main',
'camps_equations = camps.scripts.equations_driver:main',
'camps_forecast = camps.scripts.forecast_driver:main',
'camps_graphs = camps.gui.graphs:main'
]
},
}
# Function to check for internet connectivity
def check_for_internet():
try:
urllib.request.urlopen('https://www.pypi.org',timeout=1)
return True
except urllib.error.URLError as err:
return False
# Function to write version.py at the top-level camps/
def write_version_py(filename='camps/version.py'):
cnt = """
# THIS FILE IS GENERATED FROM CAMPS SETUP.PY
version = '%(version)s'
"""
a = open(filename, 'w')
try:
a.write(cnt % {'version': VERSION})
finally:
a.close()
# Check for internet connectivity
if check_for_internet():
setuptools_extra_kwargs['install_requires'] = required_packages
else:
setuptools_extra_kwargs['install_requires'] = []
# Write version py
write_version_py()
# Run the setup function
setup(
name = NAME,
version = VERSION,
description = 'Python package for Statistical Postprocessing of Meteorlogical Data',
long_description = 'Community Atmospheric Modeling Post-processing System (CAMPS)',
maintainer = 'CAMPS Development Team',
license = 'BSD',
keywords = ['numpy', 'netcdf', 'data', 'science', 'network', 'oceanography',
'meteorology', 'climate'],
classifiers = ['Development Status :: 3 - Alpha',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Intended Audience :: Science/Research',
'License :: OSI Approved',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: System :: Archiving :: Compression',
'Operating System :: OS Independent'],
packages = ['camps'],
package_data = {'camps': ['registry/*.yaml']},
platforms = ['darwin','linux'],
python_requires = '>=3.6',
include_package_data = True,
zip_safe = False,
**setuptools_extra_kwargs)