forked from pcubillos/mc3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
56 lines (47 loc) · 1.74 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
# Copyright (c) 2015-2019 Patricio Cubillos and contributors.
# MC3 is open-source software under the MIT license (see LICENSE).
import os
import re
import sys
import setuptools
from setuptools import setup, Extension
from numpy import get_include
sys.path.append('mc3')
from VERSION import __version__
srcdir = 'src_c/' # C-code source folder
incdir = 'src_c/include/' # Include folder with header files
cfiles = os.listdir(srcdir)
cfiles = list(filter(lambda x: re.search('.+[.]c$', x), cfiles))
cfiles = list(filter(lambda x: not re.search('[.#].+[.]c$', x), cfiles))
inc = [get_include(), incdir]
eca = ['-ffast-math']
ela = []
extensions = []
for cfile in cfiles:
e = Extension('mc3.lib.' + cfile.rstrip('.c'),
sources=['{:s}{:s}'.format(srcdir, cfile)],
include_dirs=inc,
extra_compile_args=eca,
extra_link_args=ela)
extensions.append(e)
with open('README.md', 'r') as f:
readme = f.read()
setup(name = 'mc3',
version = __version__,
author = 'Patricio Cubillos',
author_email = '[email protected]',
url = 'https://github.com/pcubillos/mc3',
packages = setuptools.find_packages(),
install_requires = ['numpy>=1.13.3',
'scipy>=0.17.1',
'matplotlib>=2.0',],
tests_require = ['pytest>=3.9',
'dynesty>=0.9.5'],
include_package_data=True,
license = 'MIT',
description = 'Multi-core Markov-chain Monte Carlo package.',
long_description=readme,
long_description_content_type='text/markdown',
include_dirs = inc,
entry_points={'console_scripts': ['mc3 = mc3.__main__:main']},
ext_modules = extensions)