forked from sympy/sympy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.py
executable file
·50 lines (38 loc) · 1.05 KB
/
build.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
#!/usr/bin/env python
import os
from Cython.Compiler.Main import compile
from distutils.core import setup, Extension
from distutils.command.build_ext import build_ext
source_root = os.path.dirname(__file__)
compiled_modules = [
"sympy.polys.densearith",
"sympy.polys.densebasic",
"sympy.polys.densetools",
"sympy.polys.galoistools",
"sympy.polys.factortools",
"sympy.polys.specialpolys",
"sympy.polys.monomialtools",
]
extensions = []
for module in compiled_modules:
source_file = os.path.join(source_root, *module.split('.')) + ".py"
print("Compiling module %s ..." % module)
result = compile(source_file)
if result.c_file is None:
raise RuntimeError("failed to compile %s" % module)
extensions.append(
Extension(module, sources=[result.c_file],
extra_compile_args=['-O2', '-Wall'],
)
)
setup(
name = "SymPy",
packages = [
"sympy",
"sympy.polys",
],
cmdclass = {
"build_ext": build_ext
},
ext_modules = extensions
)