-
Notifications
You must be signed in to change notification settings - Fork 3
/
setup.py
executable file
·88 lines (62 loc) · 2.42 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
import setuptools
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
import numpy as np
lib_name = 'zones'
maintainer = 'Jordan Graesser'
maintainer_email = ''
description = 'Zonal statistics on raster data'
git_url = 'http://github.com/jgrss/zones.git'
with open('README.md') as f:
long_description = f.read()
with open('LICENSE.txt') as f:
license_file = f.read()
with open('requirements.txt') as f:
required_packages = f.read()
# Parse the version from the module.
# Source: https://github.com/mapbox/rasterio/blob/master/setup.py
with open('zones/version.py') as f:
for line in f:
if line.find("__version__") >= 0:
version = line.split("=")[1].strip()
version = version.strip('"')
version = version.strip("'")
continue
def get_package_data():
return {'': ['*.md', '*.txt'],
'zones': ['datasets/raster/*.tif',
'datasets/vector/*.cpg',
'datasets/vector/*.dbf',
'datasets/vector/*.prj',
'datasets/vector/*.qpj',
'datasets/vector/*.shp',
'datasets/vector/*.shx',
'datasets/vector/*.gpkg',
'helpers/*.so',
'helpers/*.cpp']}
def get_extensions():
return [Extension('*',
sources=['zones/helpers/_dictionary.pyx'],
language='c++')]
def get_packages():
return setuptools.find_packages()
def setup_package():
include_dirs = [np.get_include()]
metadata = dict(name=lib_name,
maintainer=maintainer,
maintainer_email=maintainer_email,
description=description,
license=license_file,
version=version,
long_description=long_description,
package_data=get_package_data(),
packages=get_packages(),
ext_modules=cythonize(get_extensions()),
zip_safe=False,
download_url=git_url,
install_requires=required_packages,
include_dirs=include_dirs)
setup(**metadata)
if __name__ == '__main__':
setup_package()