-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
113 lines (106 loc) · 3.18 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
from setuptools import setup, Extension, find_packages
import os
import numpy as np
from Cython.Build import cythonize
requirements = [
'emcee',
'scipy',
'numpy',
'h5py',
'pandas',
'future',
'lru-dict'
]
have_mkl = False
try:
mklinfo = np.__config__.blas_mkl_info
if mklinfo != {}:
have_mkl = True
except:
False
have_openblas = False
try:
openblasinfo = np.__config__.openblas_info
if openblasinfo != {}:
have_openblas = True
except:
pass
openblas_link_args = ["-lgsl", "-lopenblas"]
mkl_link_args = ["-lgsl", "-lmkl_sequential", "-lmkl_core", "-lmkl_intel_lp64"]
cblas_link_args = ["-lgsl", "-lblas"]
if have_mkl:
link_args = mkl_link_args
elif have_openblas:
link_args = openblas_link_args
else:
link_args = cblas_link_args
compile_args = ['-march=native', '-O3']
try:
library_dirs = os.environ['LIBRARY_PATH'].split(':')
except KeyError:
library_dirs = []
try:
include_dirs = [np.get_include()] + os.environ['CPATH'].split(':')
except KeyError:
include_dirs = [np.get_include()]
extensions = [
Extension(
'mope._wf',
['mope/_wf.pyx'],
include_dirs = include_dirs,
extra_link_args = link_args,
extra_compile_args = compile_args,
library_dirs = library_dirs),
Extension(
'mope._util',
['mope/_util.pyx'],
include_dirs = include_dirs,
library_dirs = library_dirs),
Extension(
'mope._binom',
['mope/_binom.pyx'],
include_dirs = include_dirs,
extra_link_args = link_args,
extra_compile_args = compile_args,
library_dirs = library_dirs),
Extension(
'mope._interp',
['mope/_interp.pyx'],
include_dirs = include_dirs,
extra_compile_args = compile_args,
library_dirs = library_dirs),
Extension(
'mope._likes',
['mope/_likes.pyx'],
include_dirs = include_dirs,
extra_link_args = link_args,
library_dirs = library_dirs,
extra_compile_args = compile_args),
Extension(
'mope._poisson_binom',
['mope/_poisson_binom.pyx'],
include_dirs = include_dirs,
library_dirs = library_dirs,
extra_link_args = link_args,
extra_compile_args = compile_args),
Extension(
'mope._transition',
['mope/_transition.pyx'],
include_dirs = include_dirs,
library_dirs = library_dirs,
extra_link_args = link_args,
extra_compile_args = compile_args)
]
entry_points = {'console_scripts': ['mope = mope.cli:main']}
setup(
name='mope',
version = '0.5.1',
description='Molecular ontogenetic phylogeny estimation',
author='Peter Wilton',
author_email='[email protected]',
license='GPLv3',
install_requires = requirements,
python_requires = '>=2.7',
packages = find_packages(),
entry_points = entry_points,
ext_modules=cythonize(extensions))