-
Notifications
You must be signed in to change notification settings - Fork 20
/
setup.py
75 lines (65 loc) · 2.23 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
from setuptools import setup, find_packages
from setuptools.extension import Extension
from setuptools.command.build_ext import build_ext as _build_ext
from Cython.Build import cythonize
import os
import builtins
VERSION = '0.9.6'
PACKAGE_DIR = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(PACKAGE_DIR, "README.md"), "r") as fh:
long_description = fh.read()
class build_ext(_build_ext):
"""We assume no numpy at the begining
https://stackoverflow.com/questions/19919905/how-to-bootstrap-numpy-installation-in-setup-py
"""
def finalize_options(self):
_build_ext.finalize_options(self)
# Prevent numpy from thinking it is still in its setup process:
builtins.__NUMPY_SETUP__ = False
import numpy
self.include_dirs.append(numpy.get_include())
source_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'waterz')
include_dirs = [
source_dir,
os.path.join(source_dir, 'backend'),
# os.path.dirname(get_python_inc()),
# numpy.get_include(),
]
extensions = [
Extension(
'waterz.evaluate',
sources=['waterz/evaluate.pyx', 'waterz/frontend_evaluate.cpp'],
include_dirs=include_dirs,
language='c++',
extra_link_args=['-std=c++11'],
extra_compile_args=['-std=c++11', '-w'])
]
setup(
name='waterz',
version=VERSION,
description='Simple watershed and agglomeration for affinity graphs.',
long_description=long_description,
long_description_content_type="text/markdown",
url='https://github.com/funkey/waterz',
author='Jan Funke, Jingpeng Wu',
author_email='[email protected]',
license='MIT',
cmdclass={'build_ext': build_ext},
setup_requires=['numpy'],
install_requires=['numpy', 'cython'],
tests_require=['pytest'],
packages=find_packages(),
package_data={
'': ['*.pyx', '*.hpp', '*.cpp', '*.h', '*.py', 'backend/*.hpp'],
'backend': ['*.hpp']
},
zip_safe=False,
ext_modules=extensions,
classifiers=[
"Programming Language :: Python :: 3",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
requires_python=">=3.6, <4",
)