forked from eigency-org/eigency
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
88 lines (78 loc) · 2.93 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
import os
from os.path import basename, join
from setuptools import setup, find_packages
from setuptools.extension import Extension
import eigency
import numpy as np
__package_name__ = "eigency"
__eigen_dir__ = eigency.__eigen_dir__
__eigen_lib_dir__ = join(basename(__eigen_dir__), 'Eigen')
# Not all users may have cython installed. If they only want this as a means
# to access the Eigen header files to compile their own C++ code, then they
# may not have cython already installed. Therefore, only require cython
# for cases where the user will need to build the .cpp files from the .pyx
# files (typically from a git clone) and not for other pip installations.
# cf. discussion in PR #26.
# Follow the pattern recommended here:
# http://cython.readthedocs.io/en/latest/src/reference/compilation.html#distributing-cython-modules
try:
from Cython.Build import cythonize
# Maybe make this a command line option?
USE_CYTHON = True
ext = '.pyx'
except ImportError:
USE_CYTHON = False
ext = '.cpp'
extensions = [
Extension("eigency.conversions", ["eigency/conversions"+ext],
include_dirs = [np.get_include(), __eigen_dir__],
language="c++"
),
Extension("eigency.core", ["eigency/core"+ext],
include_dirs = [np.get_include(), __eigen_dir__],
language="c++"
)
]
if USE_CYTHON:
extensions = cythonize(extensions)
try:
import pypandoc
long_description = pypandoc.convert('README.md', 'rst')
except(IOError, ImportError):
long_description = open('README.md').read()
eigen_data_files = []
for root, dirs, files in os.walk(join(__eigen_dir__, 'Eigen')):
for f in files:
if f.endswith('.h'):
eigen_data_files.append(join(root, f))
dist = setup(
name = __package_name__,
description = "Cython interface between the numpy arrays and the Matrix/Array classes of the Eigen C++ library",
long_description=long_description,
classifiers=[
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Programming Language :: C++',
'Programming Language :: Cython',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],
license = "MIT",
author = "Wouter Boomsma",
author_email = "[email protected]",
url = "https://github.com/wouterboomsma/eigency",
use_scm_version = True,
setup_requires = ['setuptools>=38','setuptools_scm'],
ext_modules = extensions,
packages = find_packages(),
include_package_data=True,
package_data = {__package_name__: [
'*.h', '*.pxd', '*.pyx',
join(__eigen_lib_dir__, '*'),
] + eigen_data_files},
exclude_package_data = {__package_name__: [join(__eigen_lib_dir__, 'CMakeLists.txt')]},
install_requires = ['numpy']
)