-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsetup.py
executable file
·83 lines (69 loc) · 3.04 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
# Copyright 2013, Haz-Edine Assemlal
# This file is part of PYEZMINC.
#
# PYEZMINC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 2.
#
# PYEZMINC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with PYEZMINC. If not, see <http://www.gnu.org/licenses/>.
from setuptools import setup, find_packages
from distutils.extension import Extension
from Cython.Distutils import build_ext
#from Cython.Build import cythonize
import numpy
import os
# hack to allow user to specify location of minc installation
import sys
# default location of minc library
# find location of minc-toolkit
MINCDIR=os.environ.get('MINC_TOOLKIT',"/opt/minc/1.9.15")
source_path=os.path.join(os.path.dirname(__file__), "../../src")
MINCLIBS= ['minc2','z','m', 'minc_io']
# A hack to allow user to specify location of minc
# unfortunately, making it proper by extending build and build_ext and install
# commands is not documented
#
if '--mincdir' in sys.argv:
index = sys.argv.index('--mincdir')
sys.argv.pop(index) # Removes the '--mincdir'
MINCDIR = sys.argv.pop(index) # Returns the element after the '--mincdir'
ext_modules=[ Extension(
"minc.pyezminc", # name of extension
["minc/pyezminc.pyx", "minc/pyezminc.pxd",
"minc/minc_1_iterators.cpp","minc/xfm_param.cpp",
"minc/matrix-ops.cpp"], # our Cython source
libraries=MINCLIBS,
include_dirs = [os.path.join(MINCDIR,'include'),
numpy.get_include()],
library_dirs = [os.path.join(MINCDIR,'lib')],
runtime_library_dirs = [os.path.join(MINCDIR,'lib')], # RPATH settings
#extra_objects = [os.path.join(MINCDIR,'libminc_io.a')], # Use this if using static link
language="c++")] # causes Cython to create C++ source
setup(
name = 'pyezminc',
version = '1.2',
url = 'https://github.com/BIC-MNI/pyezminc',
author = 'Haz-Edine Assemlal',
author_email = '[email protected]',
classifiers=[
"Development Status :: 4 - Beta",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: Implementation :: PyPy",
"License :: OSI Approved :: BSD License",
],
install_requires = ["numpy","Cython"],
packages=find_packages(exclude=['test']),
cmdclass={'build_ext': build_ext },
py_modules = ['minc'],
ext_modules = ext_modules,
license = 'GNU GPL v2',
test_suite="test"
)
# kate: space-indent on; indent-width 4; indent-mode python;replace-tabs on;word-wrap-column 80;show-tabs on;hl python