forked from UTA-NURES/PyBoltz
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_build.py
More file actions
77 lines (70 loc) · 3.11 KB
/
setup_build.py
File metadata and controls
77 lines (70 loc) · 3.11 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
'''from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
import os
import numpy
from Cython.Distutils import build_ext
# https://stackoverflow.com/questions/11013851/speeding-up-build-process-with-distutils
ext_modules=[
Extension("*", ["Townsend/CollisionFrequencyCalc/*.pyx"], include_dirs=[numpy.get_include(), '.']),
Extension("*", ["Townsend/PulsedTownsend/*.pyx"], include_dirs=[numpy.get_include(), '.']),
Extension("*", ["Townsend/TimeOfFlight/*.pyx"], include_dirs=[numpy.get_include(), '.']),
Extension("*", ["Townsend/SteadyStateTownsend/*.pyx"], include_dirs=[numpy.get_include(), '.']),
Extension("*", ["Townsend/Friedland/*.pyx"], include_dirs=[numpy.get_include(), '.']),
Extension("*", ["Townsend/*.pyx"], include_dirs=[numpy.get_include(), '.']),
Extension("*", ["Townsend/Monte/*.pyx"], include_dirs=[numpy.get_include(), '.']),
Extension("*",["Monte/*.pyx"],include_dirs=[numpy.get_include(),'.']),
Extension("*",["*.pyx"],include_dirs=[numpy.get_include(),'.'])
]
setup(name = 'PyBoltz',
ext_modules = ext_modules,
# Inject our custom trigger
cmdclass={'build_ext': build_ext}
)
setup(ext_modules=cythonize(ext_modules))
'''
from setuptools import setup, Extension
from Cython.Distutils import build_ext
import os
from Cython.Build import cythonize
import Cython
import glob
import numpy
from io import open
def returnPyxFiles(path):
l = []
for i in os.listdir(path):
if i.endswith(".pyx") or i.endswith(".c"):
l.append(path+i)
return l
def returnPxdFiles(path):
l = []
for i in os.listdir(path):
if i.endswith(".pxd"):
l.append(path+i)
return l
def makeExtensions(path):
extensions = []
for root,dirs,files in os.walk(path):
for file in files:
if file.endswith(".pyx"):
moduleFiles = []
moduleFiles.append(root+'/'+file)
pathWithFile = root+'/'+file.split('.')[0]
moduleName = pathWithFile.replace('/','.')
extensions.append(Extension(moduleName,moduleFiles,include_dirs=[numpy.get_include(),'./PyBoltz/','./PyBoltz/C/']))
return extensions
extensions = makeExtensions('PyBoltz')
print(extensions)
'''extensions = [
Extension("*", ["Townsend/CollisionFrequencyCalc/*.pyx"], include_dirs=[numpy.get_include(), '.']),
Extension("*", ["Townsend/PulsedTownsend/*.pyx"], include_dirs=[numpy.get_include(), '.']),
Extension("*", ["Townsend/TimeOfFlight/*.pyx"], include_dirs=[numpy.get_include(), '.']),
Extension("*", ["Townsend/SteadyStateTownsend/*.pyx"], include_dirs=[numpy.get_include(), '.']),
Extension("*", ["Townsend/Friedland/*.pyx"], include_dirs=[numpy.get_include(), '.']),
Extension("*", ["Townsend/*.pyx"], include_dirs=[numpy.get_include(), '.']),
Extension("*", ["Townsend/Monte/*.pyx"], include_dirs=[numpy.get_include(), '.']),
Extension("*",["MonteFuncs/*.pyx"],include_dirs=[numpy.get_include(),'.']),
Extension("*",["*.pyx"],include_dirs=[numpy.get_include(),'.'])
]'''
setup(ext_modules=cythonize(extensions))