-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
109 lines (100 loc) · 3.25 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
"""
Test distutils setup file for the Python implementation of Functional Curation.
At present, this just exists to allow us to build our Cython SUNDIALS wrapper.
If SUNDIALS is installed in a non-standard location, it requires environment variables
(CFLAGS and LDFLAGS) to have been set up before running.
"""
import numpy
from setuptools import find_packages, setup # Must come before Cython!
from cython import inline
from Cython.Distutils import build_ext
from Cython.Distutils.extension import Extension
# Detect major sundials version (defaults to 2)
sundials_major = inline('''
cdef extern from *:
"""
#include <sundials/sundials_config.h>
#ifndef SUNDIALS_VERSION_MAJOR
#define SUNDIALS_VERSION_MAJOR 2
#endif
"""
int SUNDIALS_VERSION_MAJOR
return SUNDIALS_VERSION_MAJOR
''')
print('Building for Sundials ' + str(sundials_major) + '.x')
# Define Cython modules
ext_modules = [
Extension('fc.sundials.sundials',
sources=['fc/sundials/sundials.pxd'],
include_dirs=['.', numpy.get_include()],
libraries=['sundials_cvode', 'sundials_nvecserial'],
cython_compile_time_env={'FC_SUNDIALS_MAJOR': sundials_major},
),
Extension('fc.sundials.solver',
sources=['fc/sundials/solver.pyx'],
include_dirs=['.', numpy.get_include()],
libraries=['sundials_cvode', 'sundials_nvecserial'],
cython_compile_time_env={'FC_SUNDIALS_MAJOR': sundials_major},
),
]
# Load readme for use as long description
with open('README.md') as f:
readme = f.read()
# Setup
setup(
name='fc',
version='0.1.0',
description='Functional Curation backend for the Modelling Web Lab',
long_description=readme,
license='BSD',
maintainer='Web Lab team',
maintainer_email='[email protected]',
url='https://github.com/ModellingWebLab/weblab-fc',
packages=find_packages(exclude=['test', 'test.*']),
include_package_data=True, # Include non-python files via MANIFEST.in
zip_safe=False,
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Console',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Operating System :: POSIX',
'Operating System :: MacOS',
'Programming Language :: Python :: 3',
'Topic :: Scientific/Engineering',
],
cmdclass={'build_ext': build_ext},
ext_modules=ext_modules,
install_requires=[
'cellmlmanip',
'cython',
'Jinja2>=2.10',
'matplotlib',
'numexpr',
'numpy',
'pyparsing!=2.4.2',
'scipy',
'tables',
],
extras_require={
'dev': [
# 'line_profiler',
'pytest-xdist[psutil]',
],
'test': [
'codecov',
'flake8>=3.6',
'pytest>=3.6',
'pytest-cov',
'pytest-profiling',
],
},
entry_points={
'console_scripts': [
'fc_run = fc.cli:run_protocol',
'fc_extract_outputs = fc.cli:extract_outputs',
'fc_check_syntax = fc.cli:check_syntax',
],
},
)