-
Notifications
You must be signed in to change notification settings - Fork 18
/
setup.py
76 lines (67 loc) · 2.25 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import warnings
from setuptools import setup
from setuptools import Command
from setuptools import Extension
from Cython.Build import cythonize
try:
import sage.env
import sage.version
except ImportError:
raise ValueError("this package requires SageMath")
class TestCommand(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
import subprocess
if subprocess.call(['sage', '-tp', '--force-lib', 'src/']):
raise SystemExit("Doctest failures")
def do_cythonize():
return cythonize(
[Extension(
"*",
["src/ore_algebra/analytic/*.pyx"],
)],
aliases = sage.env.cython_aliases(),
# gdb_debug=True,
# annotate=True,
)
if list(map(int, sage.version.version.split('.')[:2])) < [10, 2]:
# Unfortunately, pip does not display this warning by default. But we will
# warn about this again when the user tries to call one of the affected
# functions.
warnings.warn(
f"Found SageMath version {sage.version.version}. The Cython extensions "
"in ore_algebra now require SageMath >= 10.2. The ore_algebra package "
"will be installed with Cython extensions disabled, making numerical "
"evaluation and related features slow. To use the full version of "
"ore_algebra, upgrade SageMath or downgrade ore_algebra to git commit "
"73a430aaf.")
extensions = []
else:
try:
from sage.misc.package_dir import cython_namespace_package_support
with cython_namespace_package_support():
extensions = do_cythonize()
except ImportError:
extensions = do_cythonize()
setup(
name = "ore_algebra",
version = "0.5",
author = "Manuel Kauers, Maximilian Jaroschek, Fredrik Johansson",
author_email = "[email protected]",
license = "GPL",
packages = [
"ore_algebra",
"ore_algebra.analytic",
"ore_algebra.analytic.examples",
"ore_algebra.examples",
],
package_dir = {'': 'src/'},
ext_modules = extensions,
include_dirs = sage.env.sage_include_directories(),
cmdclass = {'test': TestCommand},
zip_safe=False,
)