forked from SDFIdk/malstroem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
90 lines (78 loc) · 2.54 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
import logging
import sys
from codecs import open as codecs_open
from setuptools import setup, find_packages
from distutils.extension import Extension
logging.basicConfig()
log = logging.getLogger()
# --------------------------------------------------------------------------------
# Use Cython if available.
include_dirs = []
library_dirs = []
libraries = []
extra_link_args = []
ext_modules = []
try:
import numpy
include_dirs.append(numpy.get_include())
except ImportError:
log.critical("Numpy and its headers are required to run setup(). Exiting.")
sys.exit(1)
try:
from Cython.Build import cythonize
except ImportError:
cythonize = None
log.warning("Cython not available. Module will work, but will be very very slow")
if cythonize:
ext_options = dict(
include_dirs=include_dirs,
library_dirs=library_dirs,
libraries=libraries,
extra_link_args=extra_link_args)
# Make html annotation
import Cython.Compiler.Options
Cython.Compiler.Options.annotate = True
ext_modules = cythonize([
Extension('malstroem.algorithms.speedups._fill',
['malstroem/algorithms/speedups/_fill.pyx'], **ext_options),
Extension('malstroem.algorithms.speedups._flow',
['malstroem/algorithms/speedups/_flow.pyx'], **ext_options),
Extension('malstroem.algorithms.speedups._label',
['malstroem/algorithms/speedups/_label.pyx'], **ext_options)
])
# --------------------------------------------------------------------------------
# Get the long description from the relevant file
with codecs_open('README.rst', encoding='utf-8') as f:
long_description = f.read()
setup(name='malstroem',
version='0.0.1',
description=u"Calculate terrain bluespots and flow",
long_description=long_description,
classifiers=[],
keywords='',
author=u"Asger Skovbo Petersen",
author_email='[email protected]',
url='https://github.com/septima/malstroem',
license='GPL2',
packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
include_package_data=True,
zip_safe=False,
install_requires=[
'numpy',
'click',
'gdal',
'future',
'scipy',
'click-log'
],
extras_require={
'test': ['pytest'],
'speedups': ['cython'],
'doc': ['sphinx_rtd_theme']
},
entry_points="""
[console_scripts]
malstroem=malstroem.scripts.cli:cli
""",
ext_modules=ext_modules,
)