forked from ukhsa-collaboration/pygom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
106 lines (98 loc) · 3.03 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
#!/bin/env python
"""
@author: Edwin Tye ([email protected])
"""
import re
import subprocess
from setuptools import setup
from setuptools.extension import Extension
try:
import numpy
except ImportError:
raise ImportError('numpy needs to be installed before PyGOM can be '
'installed. Try installing with "pip install numpy" '
'before installing PyGOM.')
## For the cython parts ###
try:
from Cython.Distutils import build_ext
except ImportError:
use_cython = False
else:
use_cython = True
cmdclass = { }
ext_modules = [ ]
#For this to work the .c files are not include in GIT except in the release
#release branch (the c files would be created using python setup.py sdist)
if use_cython:
ext_modules += [
Extension("pygom.model._tau_leap",
["pygom/model/_tau_leap.pyx"],
include_dirs=[numpy.get_include()],
# extra_compile_args=['-fopenmp'],
# extra_link_args=['-fopenmp']),
)
]
cmdclass.update({'build_ext': build_ext})
else:
# raise ImportError('You will need Cython installed to create'
# 'the c extensions. Try installing with'
# '"pip install cython" before installing PyGOM.')
ext_modules += [
Extension("pygom.model._tau_leap",
["pygom/model/_tau_leap.c"],
include_dirs=[numpy.get_include()],
# extra_compile_args=['-fopenmp'],
# extra_link_args=['-fopenmp']),
)
]
package_data = {
'pygom.data': ['eg1.json'],# An example epijson file
}
# read the requirements file and have use that to populate install_requires
requires = open("requirements.txt").read().strip().split("\n")
install_requires = []
extras_require = {}
for r in requires:
if ";" in r:
# requirements.txt conditional dependencies need to be reformatted for wheels
# to the form: `'[extra_name]:condition' : ['requirements']`
req, cond = r.split(";", 1)
cond = ":" + cond
cond_reqs = extras_require.setdefault(cond, [])
cond_reqs.append(req)
else:
install_requires.append(r)
with open('README.rst', 'r') as f:
readme = f.read()
setup_requires = [
'setuptools-scm>=3.2.0',
'setuptools_scm_git_archive',
'numpy>=1.12.0'
]
setup(
name='pygom',
use_scm_version=True,
description='ODE modeling in Python',
long_description=readme,
long_description_content_type='text/x-rst',
license="GPL2",
url='https://github.com/PublicHealthEngland/pygom',
author="Thomas Finnie",
author_email="[email protected]",
packages=[
'pygom',
'pygom.model',
'pygom.model.ode_utils',
'pygom.loss',
'pygom.utilR'
],
package_data=package_data,
include_package_data=True,
cmdclass=cmdclass,
ext_modules=ext_modules,
install_requires=install_requires,
extras_require=extras_require,
setup_requires=setup_requires,
test_suite='tests',
scripts=[]
)