-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
79 lines (72 loc) · 2.62 KB
/
Copy pathsetup.py
File metadata and controls
79 lines (72 loc) · 2.62 KB
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
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
from Cython.Distutils import Extension, build_ext
import numpy as np
import cython_gsl
import sys
import glob
import os
include_dirs = [np.get_include(),
cython_gsl.get_cython_include_dir()]
args = sys.argv[1:]
# get rid of intermediate and library files
if "clean" in args:
print("Deleting cython files...")
to_remove = []
# C
to_remove += glob.glob('boolnet/bintools/functions.c')
to_remove += glob.glob('boolnet/bintools/biterror.c')
to_remove += glob.glob('boolnet/exptools/fastrand.c')
# C++
to_remove += glob.glob('boolnet/network/algorithms.cpp')
to_remove += glob.glob('boolnet/network/boolnet.cpp')
to_remove += glob.glob('boolnet/network/networkstate.cpp')
# Static lib files
to_remove += glob.glob('boolnet/bintools/*.so')
to_remove += glob.glob('boolnet/exptools/*.so')
to_remove += glob.glob('boolnet/network/*.so')
for f in to_remove:
os.remove(f)
# We want to always use build_ext --inplace
if args.count('build_ext') > 0 and args.count('--inplace') == 0:
sys.argv.insert(sys.argv.index('build_ext')+1, '--inplace')
extensions = [
Extension('boolnet.bintools.functions',
['boolnet/bintools/functions.pyx'],
include_dirs=include_dirs),
Extension('boolnet.bintools.biterror',
['boolnet/bintools/biterror.pyx'],
include_dirs=include_dirs),
Extension('boolnet.exptools.fastrand',
['boolnet/exptools/fastrand.pyx'],
libraries=cython_gsl.get_libraries(),
library_dirs=[cython_gsl.get_library_dir()],
include_dirs=include_dirs),
# C++
Extension('boolnet.network.algorithms',
['boolnet/network/algorithms.pyx'],
language='c++',
include_dirs=include_dirs),
Extension('boolnet.network.boolnet',
['boolnet/network/boolnet.pyx'],
language='c++',
include_dirs=include_dirs),
Extension('boolnet.network.networkstate',
['boolnet/network/networkstate.pyx'],
language='c++',
include_dirs=include_dirs),
]
setup(
name='boolnet',
include_dirs=[np.get_include(), cython_gsl.get_include()],
cmdclass={'build_ext': build_ext},
ext_modules=extensions,
scripts=['scripts/check_config.py',
'scripts/prepare_experiment.py',
'scripts/run_experiments.py',
'scripts/runexp.py',
'scripts/run_old_experiments.py',
'scripts/run_prepped_experiments.py']
)