forked from williamstein/psage
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathsetup.py
More file actions
210 lines (185 loc) · 7.9 KB
/
setup.py
File metadata and controls
210 lines (185 loc) · 7.9 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
from __future__ import print_function
#################################################################################
#
# (c) Copyright 2010 William Stein
#
# 2016 - 06 - 22: Largely reqritten by Fredrik Stromberg to work with Sage 7.2 and make use of
# more standard install routines (based on how Sage setup.py currently works)
# This file is part of PSAGE
#
# PSAGE is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# PSAGE is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#################################################################################
import os, sys, platform
from sage.env import sage_include_directories,SAGE_INC,SAGE_LIB,SAGE_LOCAL
import subprocess
if 'Darwin' in platform.platform() or 'macOS' in platform.platform():
this_platform = 'darwin'
elif 'Linux' in platform.platform():
this_platform = 'linux'
else:
this_platform = 'unkonwn'
if sys.maxsize != 2**63 - 1:
print("*"*70)
print("The PSAGE library only works on 64-bit computers. Terminating build.")
print("*"*70)
sys.exit(1)
if '-ba' in sys.argv:
print("Rebuilding all Cython extensions.")
sys.argv.remove('-ba')
FORCE = True
else:
FORCE = False
from module_list import ext_modules,aliases
include_dirs = sage_include_directories(use_sources=True)
include_dirs = include_dirs + [SAGE_LIB] + ["/usr/local/lib"]
include_dirs = include_dirs + [os.path.join(SAGE_LIB,"cysignals/")]
include_dirs = include_dirs + [os.path.join(SAGE_LIB,"sage/ext/")]
include_dirs = include_dirs + [os.path.join(SAGE_LIB,"sage/cpython/")]
extra_compile_args = [ "-fno-strict-aliasing"]
extra_link_args = []
if this_platform == 'darwin':
extra_compile_args += ["-Wno-deprecated-register" ]
# Also check if we use LLVM clang
if subprocess.call("""$CC --version | grep -i 'LLVM' >/dev/null """, shell=True) == 0:
extra_compile_args += ['-Wno-nullability-completeness',
'-Wno-expansion-to-defined',
'-Wno-undef-prefix']
include_dirs += ['/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include']
extra_link_args += ['-L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib']
elif this_platform == 'linux':
pass
DEVEL = False
if DEVEL:
extra_compile_args.append('-ggdb')
# Work around GCC-4.8.0 bug which miscompiles some sig_on() statements,
# as witnessed by a doctest in sage/libs/gap/element.pyx if the
# compiler flag -Og is used. See also
# * http://trac.sagemath.org/sage_trac/ticket/14460
# * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56982
if subprocess.call("""$CC --version | grep -i 'gcc.* 4[.]8' >/dev/null """, shell=True) == 0:
extra_compile_args.append('-fno-tree-dominator-opts')
lib_headers = { "gmp": [ os.path.join(SAGE_INC, 'gmp.h') ], # cf. #8664, #9896
"gmpxx": [ os.path.join(SAGE_INC, 'gmpxx.h') ],
"ntl": [ os.path.join(SAGE_INC, 'NTL', 'config.h') ]
}
for m in ext_modules:
m.depends = m.depends + [__file__]
# Add dependencies for the libraries
for lib in lib_headers:
if lib in m.libraries:
m.depends += lib_headers[lib]
m.extra_compile_args = m.extra_compile_args + extra_compile_args
m.extra_link_args = m.extra_link_args + extra_link_args
m.library_dirs = m.library_dirs + [os.path.join(SAGE_LOCAL, "lib")]
m.include_dirs = m.include_dirs + include_dirs
#print "include_dirs=",include_dirs
def run_cythonize():
from Cython.Build import cythonize
import Cython.Compiler.Options
import Cython.Compiler.Main
debug = False
gdb_debug = True
if os.environ.get('SAGE_DEBUG', None) == 'yes':
print('Enabling Cython debugging support')
debug = True
Cython.Compiler.Main.default_options['gdb_debug'] = True
Cython.Compiler.Main.default_options['output_dir'] = 'build'
gdb_debug=True
profile = False
if os.environ.get('SAGE_PROFILE', None) == 'yes':
print('Enabling Cython profiling support')
profile = True
Cython.Compiler.Options.get_directive_defaults()['language_level'] = 2
# Sage uses these directives (mostly for historical reasons).
Cython.Compiler.Options.embed_pos_in_docstring = True
Cython.Compiler.Options.get_directive_defaults()['autotestdict'] = False
Cython.Compiler.Options.get_directive_defaults()['cdivision'] = True
Cython.Compiler.Options.get_directive_defaults()['fast_getattr'] = True
# The globals() builtin in Cython was fixed to return to the current scope,
# but Sage relies on the broken behavior of returning to the nearest
# enclosing Python scope (e.g. to perform variable injection).
Cython.Compiler.Options.old_style_globals = True
Cython.Compiler.Main.default_options['cache'] = False
print("include_dirs1={0}".format(include_dirs))
global ext_modules
ext_modules = cythonize(
ext_modules,
gdb_debug=gdb_debug,
nthreads=int(os.environ.get('SAGE_NUM_THREADS', 0)),
# build_dir=SAGE_CYTHONIZED,
force=FORCE,
include_path = include_dirs,
aliases=aliases,
exclude_failures=False,
compiler_directives={
'embedsignature': True,
'profile': profile,
})
print("Updating Cython code....")
import time
t = time.time()
run_cythonize()
print("Finished Cythonizing, time: %.2f seconds." % (time.time() - t))
from setuptools import setup
code = setup(
name='psage',
version="2021.1.0",
description="PSAGE: Software for Number Theory and Arithmetic Geometry",
author='Stephan Ehlen, William Stein,Fredrik Stromberg, et. al.',
author_email='fredrik314@gmail.com',
url='https://github.com/fredstro/psage',
license='GPL v2+',
packages=['psage',
'psage.ellcurve',
'psage.ellcurve.lseries',
'psage.functions',
# 'psage.ellff',
# 'psage.function_fields',
'psage.groups',
'psage.lmfdb',
'psage.lmfdb.ellcurves',
'psage.lmfdb.ellcurves.sqrt5',
'psage.matrix',
'psage.modform',
'psage.modform.arithgroup',
'psage.modform.fourier_expansion_framework',
'psage.modform.fourier_expansion_framework.gradedexpansions',
'psage.modform.fourier_expansion_framework.modularforms',
'psage.modform.fourier_expansion_framework.monoidpowerseries',
'psage.modform.hilbert',
'psage.modform.hilbert.sqrt5',
'psage.modform.rational',
'psage.modform.siegel',
'psage.modform.jacobi',
'psage.modform.vector_valued',
'psage.modform.jacobiforms',
'psage.modform.weilrep_tools',
'psage.modform.maass',
'psage.modform.periods',
'psage.modules',
'psage.number_fields',
'psage.number_fields.sqrt5',
'psage.rh',
'psage.rh.mazur_stein',
'psage.rings',
'psage.zfunctions'
],
platforms=['any'],
download_url='N/A',
ext_modules=ext_modules,
requires=[
'past' # Temporary add to be able to use old_div without checking everything...
],
)