-
Notifications
You must be signed in to change notification settings - Fork 37
/
setup.py
130 lines (116 loc) · 3.4 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
#!/usr/bin/env python
import os
import subprocess
from codecs import open
from setuptools import setup
VERSION = "2.7.2"
def git_version():
"""
Return the sha1 of local git HEAD as a string.
"""
def _minimal_ext_cmd(cmd):
# construct minimal environment
env = {}
for k in ["SYSTEMROOT", "PATH", "PYTHONPATH"]:
v = os.environ.get(k)
if v is not None:
env[k] = v
# LANGUAGE is used on win32
env["LANGUAGE"] = "C"
env["LANG"] = "C"
env["LC_ALL"] = "C"
out = subprocess.Popen(cmd, stdout=subprocess.PIPE, env=env).communicate()[0]
return out
try:
out = _minimal_ext_cmd(["git", "rev-parse", "HEAD"])
git_revision = out.strip().decode("ascii")
except OSError:
git_revision = "unknown-git"
return git_revision[:7]
def write_text(filename, text):
try:
with open(filename, "w") as a:
a.write(text)
except Exception as e:
print(e)
def write_version_py(filename=os.path.join("src/ILAMB", "generated_version.py")):
cnt = """
# THIS FILE IS GENERATED FROM ILAMB SETUP.PY
short_version = '%(version)s'
version = '%(version)s'
git_revision = '%(git_revision)s'
full_version = '%(version)s (%%(git_revision)s)' %% {
'git_revision': git_revision}
release = %(isrelease)s
if not release:
version = full_version
"""
FULL_VERSION = VERSION
if os.path.isdir(".git"):
GIT_REVISION = git_version()
ISRELEASED = False
else:
GIT_REVISION = "RELEASE"
ISRELEASED = True
FULL_VERSION += ".dev-" + GIT_REVISION
text = cnt % {
"version": VERSION,
"full_version": FULL_VERSION,
"git_revision": GIT_REVISION,
"isrelease": str(ISRELEASED),
}
write_text(filename, text)
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, "README.md"), encoding="utf-8") as f:
long_description = f.read()
write_version_py()
setup(
name="ILAMB",
version=VERSION,
description="The International Land Model Benchmarking Package",
long_description=long_description,
url="https://github.com/rubisco-sfa/ILAMB.git",
author="Nathan Collier",
author_email="[email protected]",
license="BSD-3-Clause",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering",
"License :: OSI Approved :: BSD License",
"Operating System :: MacOS",
"Operating System :: POSIX",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
],
keywords=[
"benchmarking",
"earth system modeling",
"climate modeling",
"model intercomparison",
],
packages=["ILAMB"],
package_dir={"": "src"},
package_data={"ILAMB": ["data/*.cfg", "data/*.parquet"]},
scripts=["bin/ilamb-run", "bin/ilamb-fetch", "bin/ilamb-mean", "bin/ilamb-setup"],
zip_safe=False,
install_requires=[
"numpy",
"pandas",
"matplotlib",
"cartopy",
"netCDF4",
"cf-units",
"sympy",
"mpi4py",
"scipy",
"cftime",
"tqdm",
"pyarrow",
"pyyaml",
"requests",
],
extras_require={
"watershed": ["contextily", "geopandas", "dataretrieval", "pynhd"],
},
)