forked from bioinfocao/pysapc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
63 lines (54 loc) · 1.96 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
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy
from sys import platform
import warnings
compile_args = {
"macos" : ['-Xpreprocessor', '-fopenmp'],
"default" : ['-fopenmp']
}
link_args = {
"macos" : ['-Xpreprocessor', '-fopenmp', '-L/usr/local/opt/libomp/lib'],
"default" : ['-fopenmp']
}
include_dirs = {
"macos" : [numpy.get_include(), '/usr/local/opt/libomp/include'],
"default": [numpy.get_include()]
}
ext = Extension("pysapc.sparseAP_cy", ['pysapc/sparseAP_cy.pyx'])
class build_ext_subclass( build_ext ):
def build_extensions(self):
# Apply platform-specific build options
if platform[:3] == "dar": # NB "Darwin"
args_key = "macos"
msg = "\n\n\nMacOS detected, adding Apple Clang-specific build options.\n"
msg += "Note: OpenMP must be installed separately, i.e.: brew install libomp\n\n\n"
warnings.warn(msg)
else:
args_key = "default"
for e in self.extensions:
if e is ext:
e.extra_link_args = link_args[args_key]
e.extra_compile_args = compile_args[args_key]
e.include_dirs = include_dirs[args_key]
build_ext.build_extensions(self)
setup(
name="pysapc",
version="1.0.0",
description="Sparse Affinity Propagation Clustering",
author="Huojun Cao",
author_email="bioinfocao@gmail.com",
url="https://github.com/bioinfocao/pysapc",
license="BSD 3 clause",
packages=["pysapc","pysapc.tests"],
#packages = find_packages(),
package_data = {
# If any package contains *.txt or *.rst files, include them:
'': ['*.txt', '*.rst'],
},
include_package_data=True,
install_requires=["numpy","scipy","pandas","cython"],
cmdclass = {"build_ext": build_ext_subclass},
ext_modules = [ext],
)