-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
112 lines (94 loc) · 3.01 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
#! /usr/bin/env python
import os
import re
from distutils.extension import Extension
import pkg_resources
from setuptools import Extension, find_packages, setup
from setuptools.command.develop import develop
from setuptools.command.install import install
import versioneer
numpy_incl = pkg_resources.resource_filename("numpy", "core/include")
def find_extensions(path="."):
extensions = []
for root, dirs, files in os.walk(os.path.normpath(path)):
extensions += [
os.path.join(root, fname) for fname in files if fname.endswith(".pyx")
]
return [
Extension(re.sub(re.escape(os.path.sep), ".", ext[: -len(".pyx")]), [ext])
for ext in extensions
]
def register(**kwds):
import httplib, urllib
data = urllib.urlencode(kwds)
header = {
"Content-type": "application/x-www-form-urlencoded",
"Accept": "text/plain",
}
conn = httplib.HTTPConnection("csdms.colorado.edu")
conn.request("POST", "/register/", data, header)
def register_landlab():
try:
from sys import argv
import platform
data = {
"name": "landlab",
"version": __version__,
"platform": platform.platform(),
"desc": ";".join(argv),
}
register(**data)
except Exception:
pass
class install_and_register(install):
def run(self):
install.run(self)
register_landlab()
class develop_and_register(develop):
def run(self):
develop.run(self)
register_landlab()
setup(
name="landlab",
version=versioneer.get_version(),
author="Eric Hutton",
author_email="eric.hutton@colorado.edu",
url="https://github.com/landlab",
description="Plugin-based component modeling tool.",
long_description=open("README.md").read(),
python_requires=">=3.6",
setup_requires=["cython", "numpy"],
install_requires=open("requirements.txt", "r").read().splitlines(),
include_package_data=True,
classifiers=[
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Cython",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Scientific/Engineering :: Physics",
],
packages=find_packages(),
package_data={
"": [
"tests/*txt",
"data/*asc",
"data/*nc",
"data/*shp",
"test/*shx",
"data/*dbf",
"preciptest.in",
"test_*/*nc",
"test_*/*asc",
]
},
cmdclass=versioneer.get_cmdclass(
{"install": install_and_register, "develop": develop_and_register}
),
entry_points={"console_scripts": ["landlab=landlab.cmd.landlab:main"]},
include_dirs=[numpy_incl],
ext_modules=find_extensions("landlab"),
)