-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
50 lines (43 loc) · 1.29 KB
/
Copy pathsetup.py
File metadata and controls
50 lines (43 loc) · 1.29 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
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
from Cython.Distutils import Extension, build_ext
import numpy as np
import sys
import glob
import os
include_dirs = [np.get_include()]
args = sys.argv[1:]
# get rid of intermediate and library files
if "clean" in args:
print("Deleting cython files...")
to_remove = []
to_remove += glob.glob('minfs/*.c')
to_remove += glob.glob('minfs/*.cpp')
to_remove += glob.glob('minfs/*.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('minfs.utils',
['minfs/utils.pyx'],
language='c++',
include_dirs=include_dirs),
Extension('minfs.reduction_rules',
['minfs/reduction_rules.pyx'],
language='c++',
include_dirs=include_dirs),
Extension('minfs.fs_solver_raps',
['minfs/fs_solver_raps.pyx'],
language='c++',
include_dirs=include_dirs),
]
setup(
name='minfs',
include_dirs=[np.get_include()],
cmdclass={'build_ext': build_ext},
ext_modules=extensions
)