sagemath: update to 10.3.

This commit is contained in:
Gonzalo Tornaría 2023-12-09 11:21:58 -03:00 committed by Leah Neukirchen
parent a8cdcd8beb
commit 488caf8f52
10 changed files with 262 additions and 2252 deletions

View File

@ -1,4 +0,0 @@
# configuration for sage on void linux
SAGE_SHARE = "/usr/share/sagemath"
GAP_SHARE_DIR = "/usr/share/gap"
JMOL_DIR = "/usr/share/jmol"

File diff suppressed because it is too large Load Diff

View File

@ -1,92 +0,0 @@
diff --git a/src/sage/interfaces/jmoldata.py b/src/sage/interfaces/jmoldata.py
index a68e53e2d85..55c07255b74 100644
--- a/src/sage/interfaces/jmoldata.py
+++ b/src/sage/interfaces/jmoldata.py
@@ -71,6 +71,47 @@ def is_jvm_available(self):
java_version_number = int(re.sub(r'.*version "(0\.|1\.)?(\d*)[\s\S]*', r'\2', version, flags=re.S))
return java_version_number >= 7
+ def jmolpath(self):
+ """
+ Return the path to the jar file.
+
+ EXAMPLES::
+
+ sage: from sage.interfaces.jmoldata import JmolData
+ sage: JData = JmolData()
+ sage: JData.jmolpath()
+ '.../JmolData.jar'
+
+ """
+ jmolpath = os.path.join(JMOL_DIR, "JmolData.jar")
+
+ if sys.platform == 'cygwin':
+ import cygwin
+ jmolpath = cygwin.cygpath(jmolpath, 'w')
+
+ return jmolpath
+
+ def is_jmol_available(self):
+ """
+ Returns True if jmol is available and False if not.
+
+ EXAMPLES:
+
+ Check that it returns a boolean::
+
+ sage: from sage.interfaces.jmoldata import JmolData
+ sage: JData = JmolData()
+ sage: type(JData.is_jmol_available())
+ <... 'bool'>
+ """
+ if not os.path.isfile(self.jmolpath()):
+ return False
+
+ if not self.is_jvm_available():
+ return False
+
+ return True
+
def export_image(self,
targetfile,
datafile, #name (path) of data file Jmol can read or script file telling it what to read or load
@@ -154,12 +195,11 @@ def export_image(self,
sage: archive.close()
"""
# Set up paths, file names and scripts
- jmolpath = os.path.join(JMOL_DIR, "JmolData.jar")
+ jmolpath = self.jmolpath()
target_native = targetfile
if sys.platform == 'cygwin':
import cygwin
- jmolpath = cygwin.cygpath(jmolpath, 'w')
target_native = cygwin.cygpath(target_native, 'w')
if datafile_cmd != 'script':
datafile = cygwin.cygpath(datafile, 'w')
diff --git a/src/sage/plot/plot3d/base.pyx b/src/sage/plot/plot3d/base.pyx
index 253f152130c..7588cde2e27 100644
--- a/src/sage/plot/plot3d/base.pyx
+++ b/src/sage/plot/plot3d/base.pyx
@@ -278,7 +278,7 @@ cdef class Graphics3d(SageObject):
T.export_jmol(scene_zip, **opts)
from sage.interfaces.jmoldata import JmolData
jdata = JmolData()
- if not jdata.is_jvm_available():
+ if not jdata.is_jmol_available():
# We can only use JMol to generate preview if a jvm is installed
from sage.repl.rich_output.output_graphics import OutputImagePng
tachyon = self._rich_repr_tachyon(OutputImagePng, **opts)
diff --git a/src/sage/repl/rich_output/backend_ipython.py b/src/sage/repl/rich_output/backend_ipython.py
index 69e63b76d60..10ccdc0c2c8 100644
--- a/src/sage/repl/rich_output/backend_ipython.py
+++ b/src/sage/repl/rich_output/backend_ipython.py
@@ -369,7 +369,7 @@ def launch_jmol(self, output_jmol, plain_text):
from sage.doctest import DOCTEST_MODE
from sage.interfaces.jmoldata import JmolData
jdata = JmolData()
- if not jdata.is_jvm_available() and not DOCTEST_MODE:
+ if not jdata.is_jmol_available() and not DOCTEST_MODE:
raise RuntimeError('jmol cannot run, no suitable java version found')
launch_script = output_jmol.launch_script_filename()
jmol_cmd = 'jmol'

View File

@ -1,15 +0,0 @@
diff --git a/src/sage/calculus/calculus.py b/src/sage/calculus/calculus.py
index dfaafb4353f..8d62ade24c8 100644
--- a/src/sage/calculus/calculus.py
+++ b/src/sage/calculus/calculus.py
@@ -568,8 +568,8 @@ def symbolic_sum(expression, v, a, b, algorithm='maxima', hold=False):
An example of this summation with Giac::
- sage: symbolic_sum(1/(1+k^2), k, -oo, oo, algorithm='giac')
- (pi*e^(2*pi) - pi*e^(-2*pi))/(e^(2*pi) + e^(-2*pi) - 2)
+ sage: symbolic_sum(1/(1+k^2), k, -oo, oo, algorithm='giac').factor()
+ pi*(e^(2*pi) + 1)/((e^pi + 1)*(e^pi - 1))
The same summation is solved by SymPy::

View File

@ -1,182 +0,0 @@
diff --git a/src/sage/doctest/forker.py b/src/sage/doctest/forker.py
index efd28d10abe..56a9fe5e8f6 100644
--- a/src/sage/doctest/forker.py
+++ b/src/sage/doctest/forker.py
@@ -2477,19 +2477,6 @@ class DocTestTask():
['cputime', 'err', 'failures', 'optionals', 'tests', 'walltime', 'walltime_skips']
"""
- extra_globals = {}
- """
- Extra objects to place in the global namespace in which tests are run.
- Normally this should be empty but there are special cases where it may
- be useful.
-
- For example, in Sage versions 9.1 and earlier, on Python 3 add
- ``long`` as an alias for ``int`` so that tests that use the
- ``long`` built-in (of which there are many) still pass. We did
- this so that the test suite could run on Python 3 while Python 2
- was still the default.
- """
-
def __init__(self, source):
"""
Initialization.
@@ -2614,10 +2601,6 @@ def _run(self, runner, options, results):
# Remove '__package__' item from the globals since it is not
# always in the globals in an actual Sage session.
dict_all.pop('__package__', None)
-
- # Add any other special globals for testing purposes only
- dict_all.update(self.extra_globals)
-
sage_namespace = RecordingDict(dict_all)
sage_namespace['__name__'] = '__main__'
doctests, extras = self.source.create_doctests(sage_namespace)
diff --git a/src/sage/misc/session.pyx b/src/sage/misc/session.pyx
index 31454dac993..53b732309da 100644
--- a/src/sage/misc/session.pyx
+++ b/src/sage/misc/session.pyx
@@ -27,7 +27,7 @@ This saves a dictionary with ``w`` as one of the keys::
sage: z = load(os.path.join(d.name, 'session'))
sage: list(z)
- ['d', 'w']
+ ['w', 'd']
sage: z['w']
2/3
@@ -68,11 +68,12 @@ AUTHOR:
import builtins
import types
-# We want the caller's locals, but locals() is emulated in Cython
-cdef caller_locals = builtins.locals
-
# Sage imports
from sage.misc.persist import load, save, loads, dumps
+from sage.misc.lazy_import import LazyImport
+
+# We want the caller's locals, but locals() is emulated in Cython
+cdef caller_locals = builtins.locals
# This module-scope variables is used to save the
# global state of the sage environment at the moment
@@ -80,7 +81,6 @@ from sage.misc.persist import load, save, loads, dumps
state_at_init = None
-CythonFunctionType = type(lambda: None)
def init(state=None):
"""
@@ -163,9 +163,13 @@ def _is_new_var(x, v, hidden):
# definitely new.
if x not in state_at_init:
return True
+ # A lazy import that was there at init time is not new
+ if isinstance(v, LazyImport):
+ return False
# A variable could also be new even if it was there at init, say if
# its value changed.
- return x not in state_at_init or state_at_init[x] is not v
+ return state_at_init[x] is not v
+
def show_identifiers(hidden=False):
r"""
@@ -196,7 +200,7 @@ def show_identifiers(hidden=False):
sage: a = 10
sage: factor = 20
sage: show_identifiers()
- ['a', 'factor']
+ ['factor', 'a']
To get the actual value of a variable from the list, use the
:func:`globals()` function.::
@@ -210,7 +214,7 @@ def show_identifiers(hidden=False):
sage: _hello = 10
sage: show_identifiers()
- ['a', 'factor']
+ ['factor', 'a']
sage: '_hello' in show_identifiers(hidden=True)
True
@@ -218,19 +222,13 @@ def show_identifiers(hidden=False):
least in command line mode.::
sage: show_identifiers(hidden=True) # random output
- ['__', '_i', '_6', '_4', '_3', '_1', '_ii', '__doc__', '__builtins__', '___', '_9', '__name__', '_', 'a', '_i12', '_i14', 'factor', '__file__', '_hello', '_i13', '_i11', '_i10', '_i15', '_i5', '_13', '_10', '_iii', '_i9', '_i8', '_i7', '_i6', '_i4', '_i3', '_i2', '_i1', '_init_cmdline', '_14']
+ ['__builtin__', '_ih', '_oh', '_dh', 'exit', 'quit', '_', '__', '___',
+ '_i', '_ii', '_iii', '_i1', 'factor', '_i2', '_2', '_i3', 'a', '_i4',
+ '_i5', '_5', '_i6', '_6', '_i7', '_hello', '_i8', '_8', '_i9', '_9',
+ '_i10']
"""
- from sage.doctest.forker import DocTestTask
state = caller_locals()
- # Ignore extra variables injected into the global namespace by the doctest
- # runner
- _none = object()
-
- def _in_extra_globals(name, val):
- return val == DocTestTask.extra_globals.get(name, _none)
-
- return sorted([x for x, v in state.items() if _is_new_var(x, v, hidden)
- and not _in_extra_globals(x, v)])
+ return [x for x, v in state.items() if _is_new_var(x, v, hidden)]
def save_session(name='sage_session', verbose=False):
@@ -293,28 +291,44 @@ def save_session(name='sage_session', verbose=False):
sage: f = lambda x : x^2
sage: save_session(tmp_f)
sage: save_session(tmp_f, verbose=True)
- Saving...
- Not saving f: f is a function, method, class or type
...
+ Not saving f: f is a function or method
Something similar happens for cython-defined functions::
sage: g = cython_lambda('double x', 'x*x + 1.5')
sage: save_session(tmp_f, verbose=True)
- Saving...
- Not saving g: g is a function, method, class or type
...
+ Not saving g: g is a cython function or method
+
+ And the same for a lazy import::
+
+ sage: from sage.misc.lazy_import import LazyImport
+ sage: lazy_ZZ = LazyImport('sage.rings.integer_ring', 'ZZ')
+ sage: save_session(tmp_f, verbose=True)
+ ...
+ Not saving lazy_ZZ: lazy_ZZ is a lazy import
"""
state = caller_locals()
# This dict D will contain the session -- as a dict -- that we will save to disk.
D = {}
# We iterate only over the new variables that were defined in this
# session, since those are the only ones we will save.
- for k in show_identifiers(hidden = True):
+ for k in show_identifiers(hidden=True):
try:
x = state[k]
- if isinstance(x, (types.FunctionType, types.BuiltinFunctionType, types.BuiltinMethodType, CythonFunctionType, type)):
- raise TypeError('{} is a function, method, class or type'.format(k))
+
+ if isinstance(x, type):
+ raise TypeError('{} is a class or type'.format(k))
+
+ if isinstance(x, (types.FunctionType, types.BuiltinFunctionType, types.BuiltinMethodType)):
+ raise TypeError('{} is a function or method'.format(k))
+
+ if getattr(type(x), '__name__', None) == 'cython_function_or_method':
+ raise TypeError('{} is a cython function or method'.format(k))
+
+ if isinstance(x, LazyImport):
+ raise TypeError('{} is a lazy import'.format(k))
# We attempt to pickle *and* unpickle every variable to
# make *certain* that we can pickled D at the end below.

View File

@ -1,26 +0,0 @@
diff --git a/src/sage/matrix/matrix_double_dense.pyx b/src/sage/matrix/matrix_double_dense.pyx
index 5d19067f2ed..97e50fb2616 100644
--- a/src/sage/matrix/matrix_double_dense.pyx
+++ b/src/sage/matrix/matrix_double_dense.pyx
@@ -867,7 +867,7 @@ cdef class Matrix_double_dense(Matrix_numpy_dense):
# set cutoff as RDF element
if eps == 'auto':
if scipy is None: import scipy
- eps = 2*max(self._nrows, self._ncols)*scipy.finfo(float).eps*sv[0]
+ eps = 2*max(self._nrows, self._ncols)*numpy.finfo(float).eps*sv[0]
eps = RDF(eps)
# locate non-zero entries
rank = 0
diff --git a/src/sage/numerical/optimize.py b/src/sage/numerical/optimize.py
index 708d440a205..9f973c6bd69 100644
--- a/src/sage/numerical/optimize.py
+++ b/src/sage/numerical/optimize.py
@@ -426,7 +426,7 @@ def minimize(func, x0, gradient=None, hessian=None, algorithm="default",
hess = func.hessian()
hess_fast = [ [fast_callable(a, vars=var_names, domain=float) for a in row] for row in hess]
hessian = lambda p: [[a(*p) for a in row] for row in hess_fast]
- from scipy import dot
+ from numpy import dot
hessian_p = lambda p,v: dot(numpy.array(hessian(p)),v)
min = optimize.fmin_ncg(f, [float(_) for _ in x0], fprime=gradient,
fhess=hessian, fhess_p=hessian_p, disp=verbose, **args)

View File

@ -0,0 +1,229 @@
diff --git a/src/sage/interfaces/singular.py b/src/sage/interfaces/singular.py
index 9c9b8ffb8b9..12a9aa582a6 100644
--- a/src/sage/interfaces/singular.py
+++ b/src/sage/interfaces/singular.py
@@ -1211,14 +1211,14 @@ def current_ring(self):
polynomial ring, over a field, global ordering
// coefficients: ZZ/127
// number of vars : 3
- // block 1 : ordering rp
+ // block 1 : ordering ip
// : names x y z
// block 2 : ordering C
sage: singular.current_ring()
polynomial ring, over a field, global ordering
// coefficients: ZZ/127
// number of vars : 3
- // block 1 : ordering rp
+ // block 1 : ordering ip
// : names x y z
// block 2 : ordering C
"""
@@ -2040,6 +2040,9 @@ def _sage_(self, R=None):
elif typ == 'intvec':
from sage.modules.free_module_element import vector
return vector([sage.rings.integer.Integer(str(e)) for e in self])
+ elif typ == 'bigintvec':
+ from sage.modules.free_module_element import vector
+ return vector([sage.rings.rational.Rational(str(e)) for e in self])
elif typ == 'intmat':
from sage.matrix.constructor import matrix
from sage.rings.integer_ring import ZZ
diff --git a/src/sage/libs/singular/decl.pxd b/src/sage/libs/singular/decl.pxd
index e36216d6395..855c95b00bd 100644
--- a/src/sage/libs/singular/decl.pxd
+++ b/src/sage/libs/singular/decl.pxd
@@ -243,7 +243,7 @@ cdef extern from "singular/Singular/libsingular.h":
ringorder_s
ringorder_lp
ringorder_dp
- ringorder_rp
+ ringorder_ip
ringorder_Dp
ringorder_wp
ringorder_Wp
@@ -291,6 +291,10 @@ cdef extern from "singular/Singular/libsingular.h":
int row
int col
+ cdef cppclass bigintmat:
+ int (*length)()
+ number* (*get)(int i)
+
# omalloc bins
ctypedef struct omBin "omBin_s"
@@ -921,6 +925,7 @@ cdef extern from "singular/Singular/libsingular.h":
cdef int MATRIX_CMD
cdef int LIST_CMD
cdef int INTVEC_CMD
+ cdef int BIGINTVEC_CMD
cdef int NONE
cdef int RESOLUTION_CMD
cdef int PACKAGE_CMD
diff --git a/src/sage/libs/singular/function.pyx b/src/sage/libs/singular/function.pyx
index ac4bde0c20b..8284cb921a3 100644
--- a/src/sage/libs/singular/function.pyx
+++ b/src/sage/libs/singular/function.pyx
@@ -98,7 +98,7 @@ from sage.rings.polynomial.multi_polynomial_sequence import PolynomialSequence_g
from sage.libs.singular.decl cimport *
from sage.libs.singular.option import opt_ctx
from sage.libs.singular.polynomial cimport singular_vector_maximal_component
-from sage.libs.singular.singular cimport sa2si, si2sa, si2sa_intvec
+from sage.libs.singular.singular cimport sa2si, si2sa, si2sa_intvec, si2sa_bigintvec
from sage.libs.singular.singular import error_messages
from sage.interfaces.singular import get_docstring
@@ -954,6 +954,8 @@ cdef class Converter(SageObject):
return si2sa(<number *>to_convert.data, self._singular_ring, self._sage_ring.base_ring())
elif rtyp == INTVEC_CMD:
return si2sa_intvec(<intvec *> to_convert.data)
+ elif rtyp == BIGINTVEC_CMD:
+ return si2sa_bigintvec(<bigintmat *> to_convert.data)
elif rtyp == STRING_CMD:
# TODO: Need to determine what kind of data can be returned by a
# STRING_CMD--is it just ASCII strings or can it be an arbitrary
@@ -1231,7 +1233,7 @@ cdef class SingularFunction(SageObject):
Traceback (most recent call last):
...
RuntimeError: error in Singular function call 'size':
- Wrong number of arguments (got 2 arguments, arity code is 302)
+ Wrong number of arguments (got 2 arguments, arity code is 303)
sage: size('foobar', ring=P)
6
@@ -1634,17 +1636,17 @@ def singular_function(name):
Traceback (most recent call last):
...
RuntimeError: error in Singular function call 'factorize':
- Wrong number of arguments (got 0 arguments, arity code is 305)
+ Wrong number of arguments (got 0 arguments, arity code is 306)
sage: factorize(f, 1, 2)
Traceback (most recent call last):
...
RuntimeError: error in Singular function call 'factorize':
- Wrong number of arguments (got 3 arguments, arity code is 305)
+ Wrong number of arguments (got 3 arguments, arity code is 306)
sage: factorize(f, 1, 2, 3)
Traceback (most recent call last):
...
RuntimeError: error in Singular function call 'factorize':
- Wrong number of arguments (got 4 arguments, arity code is 305)
+ Wrong number of arguments (got 4 arguments, arity code is 306)
The Singular function ``list`` can be called with any number of
arguments::
diff --git a/src/sage/libs/singular/ring.pyx b/src/sage/libs/singular/ring.pyx
index 494fd2c0caf..7b05d63e7c7 100644
--- a/src/sage/libs/singular/ring.pyx
+++ b/src/sage/libs/singular/ring.pyx
@@ -24,7 +24,7 @@ from sage.libs.gmp.mpz cimport mpz_init_set_ui
from sage.libs.singular.decl cimport ring, currRing
from sage.libs.singular.decl cimport rChangeCurrRing, rComplete, rDelete, idInit
from sage.libs.singular.decl cimport omAlloc0, omStrDup, omAlloc
-from sage.libs.singular.decl cimport ringorder_dp, ringorder_Dp, ringorder_lp, ringorder_rp, ringorder_ds, ringorder_Ds, ringorder_ls, ringorder_M, ringorder_c, ringorder_C, ringorder_wp, ringorder_Wp, ringorder_ws, ringorder_Ws, ringorder_a, rRingOrder_t
+from sage.libs.singular.decl cimport ringorder_dp, ringorder_Dp, ringorder_lp, ringorder_ip, ringorder_ds, ringorder_Ds, ringorder_ls, ringorder_M, ringorder_c, ringorder_C, ringorder_wp, ringorder_Wp, ringorder_ws, ringorder_Ws, ringorder_a, rRingOrder_t
from sage.libs.singular.decl cimport prCopyR
from sage.libs.singular.decl cimport n_unknown, n_algExt, n_transExt, n_Z, n_Zn, n_Znm, n_Z2m
from sage.libs.singular.decl cimport n_coeffType
@@ -60,7 +60,7 @@ order_dict = {
"dp": ringorder_dp,
"Dp": ringorder_Dp,
"lp": ringorder_lp,
- "rp": ringorder_rp,
+ "ip": ringorder_ip,
"ds": ringorder_ds,
"Ds": ringorder_Ds,
"ls": ringorder_ls,
diff --git a/src/sage/libs/singular/singular.pxd b/src/sage/libs/singular/singular.pxd
index d943a1018a2..f398d27a1fa 100644
--- a/src/sage/libs/singular/singular.pxd
+++ b/src/sage/libs/singular/singular.pxd
@@ -1,4 +1,4 @@
-from sage.libs.singular.decl cimport ring, poly, number, intvec
+from sage.libs.singular.decl cimport ring, poly, number, intvec, bigintmat
from sage.libs.singular.function cimport Resolution
from sage.rings.rational cimport Rational
@@ -29,6 +29,7 @@ cdef object si2sa_ZZmod(number *n, ring *_ring, object base) noexcept
cdef object si2sa_NF(number *n, ring *_ring, object base) noexcept
cdef object si2sa_intvec(intvec *v) noexcept
+cdef object si2sa_bigintvec(bigintmat *v) noexcept
# dispatches to all the above.
cdef object si2sa(number *n, ring *_ring, object base) noexcept
diff --git a/src/sage/libs/singular/singular.pyx b/src/sage/libs/singular/singular.pyx
index cf0124e0a35..0e5c7774e80 100644
--- a/src/sage/libs/singular/singular.pyx
+++ b/src/sage/libs/singular/singular.pyx
@@ -1699,6 +1699,25 @@ cdef object si2sa_intvec(intvec *v) noexcept:
l.append(v.get(r))
return tuple(l)
+cdef object si2sa_bigintvec(bigintmat *v) noexcept:
+ r"""
+ create a sage tuple from a singular vector of big integers
+
+ INPUT:
+
+ - ``v`` -- a (pointer to) singular bigintmat
+
+ OUTPUT:
+
+ a sage tuple
+ """
+ cdef int r
+ cdef list l = list()
+ for r in range(v.length()):
+ n = v.get(r)
+ l.append(si2sa_QQ(n, &n, currRing))
+ return tuple(l)
+
# ==============
# Initialisation
# ==============
diff --git a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
index 70386eb0b50..b18c53de177 100644
--- a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
+++ b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
@@ -1285,7 +1285,7 @@ cdef class MPolynomialRing_libsingular(MPolynomialRing_base):
polynomial ring, over a field, global ordering
// coefficients: ZZ/2[a]/(a^8+a^4+a^3+a^2+1)
// number of vars : 10
- // block 1 : ordering rp
+ // block 1 : ordering ip
// : names x0 x1 x2 x3 x4 x5 x6 x7 x8 x9
// block 2 : ordering C
@@ -1294,7 +1294,7 @@ cdef class MPolynomialRing_libsingular(MPolynomialRing_base):
polynomial ring, over a field, global ordering
// coefficients: ZZ/127
// number of vars : 2
- // block 1 : ordering rp
+ // block 1 : ordering ip
// : names x0 x1
// block 2 : ordering C
@@ -1303,7 +1303,7 @@ cdef class MPolynomialRing_libsingular(MPolynomialRing_base):
polynomial ring, over a field, global ordering
// coefficients: QQ
// number of vars : 2
- // block 1 : ordering rp
+ // block 1 : ordering ip
// : names x0 x1
// block 2 : ordering C
diff --git a/src/sage/rings/polynomial/term_order.py b/src/sage/rings/polynomial/term_order.py
index 48e49ac89fa..65e68681485 100644
--- a/src/sage/rings/polynomial/term_order.py
+++ b/src/sage/rings/polynomial/term_order.py
@@ -388,7 +388,7 @@
singular_name_mapping = {
'lex' : 'lp',
- 'invlex' : 'rp',
+ 'invlex' : 'ip',
'degrevlex' : 'dp',
'deglex' : 'Dp',
'neglex' : 'ls',

View File

@ -20,11 +20,5 @@ get_pr() {
# run from patches dir
cd $(dirname "$0")
# all merged in 10.3.beta6 or before
get_pr 35848 "flintlib 3.0"
get_pr 36769 "fix jmol detect"
get_pr 36862 "giac 1.9.0-73"
get_pr 37004 "fix save_session when cython changes"
# positive review
get_pr 37123 "scipy 1.12"
# needs review
get_pr 37492 "singular 4.3.2p16"

View File

@ -1,13 +1,12 @@
# Template file for 'sagemath'
pkgname=sagemath
version=10.2
revision=2
version=10.3
revision=1
build_wrksrc=pkgs/sagemath-standard
build_style=python3-module
_bindir=/usr/lib/sagemath/$version/bin
make_install_args="--install-scripts=$_bindir"
build_style=python3-pep517
make_build_args="--skip-dependency-check"
hostmakedepends="m4 pkg-config python3-Cython python3-Jinja2
python3-pkgconfig python3-setuptools"
python3-pkgconfig python3-setuptools python3-wheel"
makedepends="boost-devel brial-devel cliquer-devel ecl eclib-devel
ecm-devel fflas-ffpack flintlib-devel gap-devel gd-devel giac-devel glpk-devel
gsl-devel iml-devel lcalc-devel libbraiding-devel libhomfly-devel libmpc-devel
@ -24,7 +23,7 @@ depends="eclib-devel fflas-ffpack flintlib-devel gcc-fortran meson gd-devel
python3-memory_allocator python3-networkx python3-pip python3-pkgconfig
python3-pplpy python3-primecountpy python3-requests python3-scipy
python3-sympy python3-traitlets sage-data-combinatorial_designs
sage-data-conway_polynomials sage-data-elliptic_curves sage-data-graphs
python3-conway-polynomials sage-data-elliptic_curves sage-data-graphs
sage-data-polytopes_db sympow tachyon threejs-sage"
checkdepends="$depends pythran python3-Sphinx"
short_desc="Open source mathematics software"
@ -33,70 +32,42 @@ license="GPL-2.0-or-later"
homepage="https://www.sagemath.org/"
changelog="https://github.com/sagemath/sage/releases"
distfiles="https://github.com/sagemath/sage/archive/refs/tags/$version.tar.gz"
checksum=e7125f13495e1068edab73735aca7f9b2c655688096e9d109e628c023e76411f
checksum=59feb92c05e74d6db7a75f398c45c24b5157b1ecd3d8ac198806e2e6add77d96
nocross="due to ntl (eclib, singular), fflas-ffpack, givaro, linbox, sympow, maxima"
# parallel build
export SAGE_NUM_THREADS="$XBPS_MAKEJOBS"
post_patch() {
# git tree needs bootstrapping
$wrksrc/bootstrap sagelib
}
pre_build() {
export PYTHONPATH=../sage-setup
export PYTHONDONTWRITEBYTECODE=yes
export SAGE_NUM_THREADS="$XBPS_MAKEJOBS"
}
post_build() {
_lib=$(cd build/lib* && pwd)
_scripts=$(cd build/scripts* && pwd)
# configuration files
cp ${FILESDIR}/sage_conf.py $_lib
cp ${FILESDIR}/sage-env-config $_scripts
}
pre_install() {
export PYTHONPATH=../sage-setup
export PYTHONDONTWRITEBYTECODE=yes
export SAGE_NUM_THREADS="$XBPS_MAKEJOBS"
# we need sage_setup here
ln -s ../../src/sage_setup .
}
post_install() {
# fix jupyter kernel spec
vsed -i -e 's|"/usr/bin/sage"|"'${_bindir}'/sage"|' \
${DESTDIR}/usr/share/jupyter/kernels/sagemath/kernel.json
# move scripts to /usr/libexec
vmkdir usr/libexec
mv -T ${DESTDIR}/usr/bin ${DESTDIR}/usr/libexec/sagemath
# replace broken symlinks by good copies (sagemath logo images)
for file in $(ls sage/ext_data/notebook-ipython); do
rm ${DESTDIR}/usr/share/jupyter/kernels/sagemath/$file
cp -a sage/ext_data/notebook-ipython/$file \
${DESTDIR}/usr/share/jupyter/kernels/sagemath
done
# we don't have docs here
rm ${DESTDIR}/usr/share/jupyter/kernels/sagemath/doc
# this symlink is shipped in threejs-sage pkg
rm ${DESTDIR}/usr/share/jupyter/nbextensions/threejs-sage
# copy configuration
cp ${FILESDIR}/sage-env-config ${DESTDIR}/usr/libexec/sagemath
# symlink main binary
vmkdir usr/bin
ln -s $_bindir/sage ${DESTDIR}/usr/bin/sage-${version}
ln -s sage-${version} ${DESTDIR}/usr/bin/sage
ln -s /usr/libexec/sagemath/sage ${DESTDIR}/usr/bin
}
do_check() {
_lib=$(cd build/lib* && pwd)
_scripts=$(cd build/scripts* && pwd)
local testdir="${wrksrc}/.xbps-testdir/$(date +%s)"
python3 -m installer -d "${testdir}" dist/*.whl
export PYTHONPATH=$_lib
export PYTHONDONTWRITEBYTECODE=yes
# get out of $build_wrksrc, otherwise python picks the wrong sage module
cd $(mktemp -dp build)
# this makes for nicer (shorter) relative paths in output
cd ${testdir}/${py3_sitelib}
if [ -f ${XBPS_DISTDIR}/sagemath-check ] ; then
_sed='s|#.*||;/^\s*$/d;s|^\([^ ]*/\)\?sage/|'$_lib'/sage/|g' \
_sed='s|#.*||;/^\s*$/d;s|^\s*\([^ ]*/\)\?sage/|sage/|g' \
_test_files=$(sed -e "$_sed" ${XBPS_DISTDIR}/sagemath-check)
fi
if [ -z "$_test_files" ]; then
@ -105,13 +76,15 @@ do_check() {
cp ${FILESDIR}/timings2.json .
_test_args="--stats_path=timings2.json"
if [ "$XBPS_CHECK_PKGS" = full ]; then
_test_args+=" --long --warn-long 60.0"
_test_args+=" --long --warn-long 30.0"
else
_test_args+=" --warn-long 30.0"
_test_args+=" --warn-long 10.0"
fi
if [ "$XBPS_BUILD_ENVIRONMENT" = "void-packages-ci" ]; then
# for CI use a predictable random seed
_test_args+=" --random-seed=0"
fi
$_scripts/sage -tp ${XBPS_MAKEJOBS} ${_test_args} ${_test_files}
PATH="${testdir}/usr/bin:${PATH}" PYTHONPATH="${testdir}/${py3_sitelib}" \
sage -tp ${XBPS_MAKEJOBS} ${_test_args} ${_test_files}
}

View File

@ -1,6 +1,6 @@
pkgname="sage"
site="https://mirrors.mit.edu/sage/src/"
if [[ "$version" == *[abr]* ]]; then
site+="
site="https://mirrors.mit.edu/sage/src/
https://mirrors.mit.edu/sage/devel/"
if [[ "$version" != *[abr]* ]]; then
ignore="*[abr]*"
fi