-
Notifications
You must be signed in to change notification settings - Fork 21
/
setup.py
executable file
·138 lines (127 loc) · 4.39 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!/usr/bin/env python
import pathlib
import setuptools # type: ignore[import]
import subprocess
import sys
subprocess.check_call(
[sys.executable, '-m', 'pip', 'install', '--upgrade', 'pip'])
subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'wheel'])
try:
from dunamai import Version
except ImportError:
subprocess.check_call(
[sys.executable, '-m', 'pip', 'install', 'dunamai']
)
from dunamai import Version # type: ignore[import]
try:
version = Version.from_any_vcs().serialize()
except RuntimeError:
version = '0.0.0'
except ValueError as e:
if "time data '%cI' does not match format '%Y-%m-%dT%H:%M:%S%z'" in str(e):
version = '0.0.0'
else:
raise
class BuildSchism(setuptools.Command):
description = "build external SCHISM dependencies"
user_options = [
('url=', None, 'Path for git clone of SCHISM source.'),
('branch=', None, 'Branch to use for install'),
('hydro=', None, 'Branch to use for install')
]
def initialize_options(self):
self.url = None
self.branch = None
self.hydro = None
def finalize_options(self):
self.url = 'https://github.com/schism-dev/schism' if self.url is None \
else self.url
self.branch = 'master' if self.branch is None else self.branch
self.hydro = True if self.hydro is None else bool(self.hydro)
def run(self):
print(self.url, self.branch, self.hydro)
# subprocess.check_call(["git", "clone", "submodules/jigsaw-python"])
# # install jigsawpy
# os.chdir(PARENT / 'submodules/jigsaw-python')
# subprocess.check_call(["git", "checkout", "master"])
# self.announce('INSTALLING JIGSAWPY', level=3)
# subprocess.check_call(["python", "setup.py", "install"])
# # install jigsaw
# self.announce(
# 'INSTALLING JIGSAW LIBRARY AND BINARIES FROM '
# 'https://github.com/dengwirda/jigsaw-python', level=3)
# os.chdir("external/jigsaw")
# os.makedirs("build", exist_ok=True)
# os.chdir("build")
# gcc, cpp = self._check_gcc_version()
# subprocess.check_call(
# ["cmake", "..",
# "-DCMAKE_BUILD_TYPE=Release",
# f"-DCMAKE_INSTALL_PREFIX={PYENV_PREFIX}",
# f"-DCMAKE_C_COMPILER={gcc}",
# f"-DCMAKE_CXX_COMPILER={cpp}",
# ])
# subprocess.check_call(["make", f"-j{cpu_count()}", "install"])
# libsaw_prefix = list(PYENV_PREFIX.glob("**/*jigsawpy*")).pop() / '_lib'
# os.makedirs(libsaw_prefix, exist_ok=True)
# envlib = PYENV_PREFIX / 'lib' / SYSLIB[platform.system()]
# os.symlink(envlib, libsaw_prefix / envlib.name)
# os.chdir(PARENT)
# subprocess.check_call(
# ["git", "submodule", "deinit", "-f", "submodules/jigsaw-python"])
parent = pathlib.Path(__file__).parent.absolute()
conf = setuptools.config.read_configuration(parent / 'setup.cfg')
meta = conf['metadata']
setuptools.setup(
name=meta['name'],
version=version,
author=meta['author'],
author_email=meta['author_email'],
description=meta['description'],
long_description=meta['long_description'],
long_description_content_type="text/markdown",
url=meta['url'],
packages=setuptools.find_packages(exclude=['tests', 'examples', 'docs', 'docker']),
python_requires='>=3.8',
setup_requires=['wheel', 'setuptools_scm', 'setuptools>=41.2',
'netcdf-flattener>=1.2.0'],
include_package_data=True,
extras_require={'dev': ['coverage', 'flake8', 'nose']},
cmdclass={
"build_schism": BuildSchism
},
install_requires=[
'boto3',
'cdsapi>=0.7.0',
'cf-python',
'cfgrib',
'f90nml',
'fsspec',
'geopandas>=0.10',
'metpy',
'netCDF4',
'netcdf-flattener>=1.2.0',
'numba',
'ordered-set',
'psutil',
'pygeos',
'pyugrid',
'rtree',
'scipy',
'seawater',
'sqlalchemy',
'stormevents',
'tqdm',
'tqdm-logging-wrapper',
'utm',
'wget',
'xarray',
'xmltodict',
'zarr',
'appdirs',
'pylib-essentials',
],
entry_points={'console_scripts': ['pyschism = pyschism.__main__:main']},
tests_require=['nose'],
test_suite='nose.collector',
)