diff --git a/srcpkgs/sagemath/patches/40594-Fix_segfault_in_libgap.patch b/srcpkgs/sagemath/patches/40594-Fix_segfault_in_libgap.patch deleted file mode 100644 index b26ac2f691c429..00000000000000 --- a/srcpkgs/sagemath/patches/40594-Fix_segfault_in_libgap.patch +++ /dev/null @@ -1,51 +0,0 @@ -diff --git a/src/sage/libs/gap/element.pyx b/src/sage/libs/gap/element.pyx -index f52a73c2ded..2ef40fd0a69 100644 ---- a/src/sage/libs/gap/element.pyx -+++ b/src/sage/libs/gap/element.pyx -@@ -2498,11 +2498,17 @@ cdef class GapElement_Function(GapElement): - cdef Obj result = NULL - cdef Obj arg_list - cdef int n = len(args) -- cdef volatile Obj v2 -- -- if n > 0 and n <= 3: -- libgap = self.parent() -- a = [x if isinstance(x, GapElement) else libgap(x) for x in args] -+ cdef Obj a[3] -+ -+ if n <= 3: -+ if not all(isinstance(x, GapElement) for x in args): -+ libgap = self.parent() -+ args = tuple(x if isinstance(x, GapElement) else libgap(x) for x in args) -+ for i in range(n): -+ x = args[i] -+ a[i] = (x).value -+ else: -+ arg_list = make_gap_list(args) - - try: - sig_GAP_Enter() -@@ -2510,20 +2516,12 @@ cdef class GapElement_Function(GapElement): - if n == 0: - result = GAP_CallFunc0Args(self.value) - elif n == 1: -- result = GAP_CallFunc1Args(self.value, -- (a[0]).value) -+ result = GAP_CallFunc1Args(self.value, a[0]) - elif n == 2: -- result = GAP_CallFunc2Args(self.value, -- (a[0]).value, -- (a[1]).value) -+ result = GAP_CallFunc2Args(self.value, a[0], a[1]) - elif n == 3: -- v2 = (a[2]).value -- result = GAP_CallFunc3Args(self.value, -- (a[0]).value, -- (a[1]).value, -- v2) -+ result = GAP_CallFunc3Args(self.value, a[0], a[1], a[2]) - else: -- arg_list = make_gap_list(args) - result = GAP_CallFuncList(self.value, arg_list) - sig_off() - finally: diff --git a/srcpkgs/sagemath/patches/40816-Meson:_Build_docs_for_Maxima_as_well.patch b/srcpkgs/sagemath/patches/40816-Meson:_Build_docs_for_Maxima_as_well.patch new file mode 100644 index 00000000000000..979b47e5d7d6f7 --- /dev/null +++ b/srcpkgs/sagemath/patches/40816-Meson:_Build_docs_for_Maxima_as_well.patch @@ -0,0 +1,22 @@ +diff --git a/src/sage/interfaces/maxima_lib.py b/src/sage/interfaces/maxima_lib.py +index 637ef29a6f2..8b5bf5a6d4f 100644 +--- a/src/sage/interfaces/maxima_lib.py ++++ b/src/sage/interfaces/maxima_lib.py +@@ -210,7 +210,7 @@ + if MAXIMA_SHARE: + import_packages = "{affine,algebra,algebra/charsets,algebra/solver,amatrix,bernstein,calculus,cobyla,cobyla/ex,cobyla/lisp,colnew,colnew/ex1,colnew/ex2,colnew/ex3,colnew/ex4,colnew/lisp,combinatorics,contrib,contrib/Eulix,contrib/Grobner,contrib/Zeilberger,contrib/alt-display,contrib/altsimp,contrib/binsplit,contrib/bitwise,contrib/boolsimp,contrib/coma,contrib/diffequations,contrib/diffequations/tests,contrib/elliptic_curves,contrib/elliptic_curves/figures,contrib/format,contrib/fresnel,contrib/gentran,contrib/gentran/man,contrib/gentran/test,contrib/gf,contrib/integration,contrib/levin,contrib/lurkmathml,contrib/maxima-odesolve,contrib/maximaMathML,contrib/mcclim,contrib/noninteractive,contrib/odes,contrib/operatingsystem,contrib/prim,contrib/rand,contrib/rkf45,contrib/sarag,contrib/smath,contrib/state,contrib/symplectic_ode,contrib/trigtools,contrib/unicodedata,contrib/unit,contrib/vector3d,descriptive,diff_form,diff_form/tests,diffequations,distrib,draw,dynamics,ezunits,fftpack5,fftpack5/lisp,finance,fourier_elim,fractals,graphs,hompack,hompack/lisp,hypergeometric,integequations,integer_sequence,integration,lapack,lapack/blas,lapack/lapack,lbfgs,linearalgebra,logic,lsquares,macro,matrix,minpack,minpack/lisp,misc,mnewton,multiadditive,nelder_mead,numeric,numericalio,odepack,odepack/src,orthopoly,pdiff,physics,pslq,pytranslate,quantum,simplex,simplex/Tests,simplification,solve_rat_ineq,solve_rec,sound,stats,stringproc,sym,tensor,tensor/tracefree-code,test_batch_encodings,to_poly_solve,translators,translators/m2mj,trigonometry,utils,vector,z_transform}" + ecl_eval(f'#$file_search_maxima: append(file_search_maxima, ["{MAXIMA_SHARE}/###.{{mac,mc,wxm}}", "{MAXIMA_SHARE}/{import_packages}/###.{{mac,mc,wxm}}"])$') +- ecl_eval(f'#$file_search_lisp: append(file_search_lisp, ["{MAXIMA_SHARE}/###.{{fas,lisp,lsp}}", "{MAXIMA_SHARE}/{import_packages}/###.{{fas,lisp,lsp}}"])$') ++ ecl_eval(f'#$file_search_lisp: append(file_search_lisp, ["{MAXIMA_SHARE}/###.{{fas,lisp,lsp}}", "{MAXIMA_SHARE}/../src/###.{{fas,lisp,lsp}}", "{MAXIMA_SHARE}/{import_packages}/###.{{fas,lisp,lsp}}"])$') + + # Default options set in Maxima + # display2d -- no ascii art output +diff --git a/subprojects/packagefiles/maxima/build/doc/info/meson.build b/subprojects/packagefiles/maxima/build/doc/info/meson.build +new file mode 100644 +index 00000000000..e8c69f73526 +diff --git a/subprojects/packagefiles/maxima/build/doc/meson.build b/subprojects/packagefiles/maxima/build/doc/meson.build +new file mode 100644 +index 00000000000..eba36e4bdc3 +diff --git a/subprojects/packagefiles/maxima/build/meson.build b/subprojects/packagefiles/maxima/build/meson.build +new file mode 100644 +index 00000000000..4112780103d diff --git a/srcpkgs/sagemath/patches/41021-Refactor_atexit.pyx_for_python_3.14.patch b/srcpkgs/sagemath/patches/41021-Refactor_atexit.pyx_for_python_3.14.patch deleted file mode 100644 index 2adf116fcf59d6..00000000000000 --- a/srcpkgs/sagemath/patches/41021-Refactor_atexit.pyx_for_python_3.14.patch +++ /dev/null @@ -1,138 +0,0 @@ -diff --git a/src/sage/cpython/atexit.pyx b/src/sage/cpython/atexit.pyx -index c74c1d0308a..e6ecad9eadc 100644 ---- a/src/sage/cpython/atexit.pyx -+++ b/src/sage/cpython/atexit.pyx -@@ -144,51 +144,99 @@ cdef class restore_atexit: - _set_exithandlers(self._exithandlers) - - from cpython.ref cimport PyObject -+import sys - --# Implement "_atexit_callbacks()" for each supported python version -+# Implement a uniform interface for getting atexit callbacks - cdef extern from *: - """ -+ #ifndef Py_BUILD_CORE - #define Py_BUILD_CORE -+ #endif - #undef _PyGC_FINALIZED - #include "internal/pycore_interp.h" - #include "internal/pycore_pystate.h" -- #if PY_VERSION_HEX >= 0x030c0000 -- // struct atexit_callback was renamed in 3.12 to atexit_py_callback -- #define atexit_callback atexit_py_callback -- #endif -- static atexit_callback ** _atexit_callbacks(PyObject *self) { -+ -+ // Always define this struct for Cython's use -+ typedef struct { -+ PyObject *func; -+ PyObject *args; -+ PyObject *kwargs; -+ } atexit_callback_struct; -+ -+ #if PY_VERSION_HEX >= 0x030e0000 -+ // Python 3.14+: atexit uses a PyList -+ static PyObject* get_atexit_callbacks_list(PyObject *self) { - PyInterpreterState *interp = _PyInterpreterState_GET(); - struct atexit_state state = interp->atexit; - return state.callbacks; - } -+ -+ // Dummy function for Python 3.14+ (never called) -+ static atexit_callback_struct** get_atexit_callbacks_array(PyObject *self) { -+ PyErr_SetString(PyExc_RuntimeError, "Python >= 3.14 has no atexit array"); -+ return NULL; -+ } -+ #else -+ // Python < 3.14: atexit uses C array -+ static atexit_callback_struct** get_atexit_callbacks_array(PyObject *self) { -+ PyInterpreterState *interp = _PyInterpreterState_GET(); -+ struct atexit_state state = interp->atexit; -+ // Cast from atexit_callback** to our struct type -+ return (atexit_callback_struct**)state.callbacks; -+ } -+ -+ // Dummy function for Python < 3.14 (never called) -+ static PyObject* get_atexit_callbacks_list(PyObject *self) { -+ PyErr_SetString(PyExc_RuntimeError, "Python < 3.14 has no atexit list"); -+ return NULL; -+ } -+ #endif - """ -- ctypedef struct atexit_callback: -+ # Declare both functions - they exist in all Python versions (one is dummy) -+ object get_atexit_callbacks_list(object module) -+ -+ ctypedef struct atexit_callback_struct: - PyObject* func - PyObject* args - PyObject* kwargs -- atexit_callback** _atexit_callbacks(object module) -+ atexit_callback_struct** get_atexit_callbacks_array(object module) except NULL - - - def _get_exithandlers(): - """Return list of exit handlers registered with the atexit module.""" -- cdef atexit_callback ** callbacks -- cdef atexit_callback callback -- cdef list exithandlers -+ cdef list exithandlers = [] -+ cdef atexit_callback_struct ** callbacks -+ cdef atexit_callback_struct callback - cdef int idx - cdef object kwargs -- -- exithandlers = [] -- callbacks = _atexit_callbacks(atexit) -- -- for idx in range(atexit._ncallbacks()): -- callback = callbacks[idx][0] -- if callback.kwargs: -- kwargs = callback.kwargs -- else: -- kwargs = {} -- exithandlers.append((callback.func, -- callback.args, -- kwargs)) -+ -+ # Python 3.14+ uses a PyList directly -+ if sys.version_info >= (3, 14): -+ callbacks_list = get_atexit_callbacks_list(atexit) -+ if callbacks_list is None: -+ return exithandlers -+ # callbacks is a list of tuples: [(func, args, kwargs), ...] -+ # Normalize kwargs to ensure it's always a dict (not None) -+ # Note: In Python 3.14+, atexit stores callbacks in LIFO order -+ # (most recently registered first), but we return them in FIFO -+ # order (registration order) for consistency with earlier versions -+ for item in reversed(callbacks_list): -+ func, args, kwargs = item -+ if kwargs is None: -+ kwargs = {} -+ exithandlers.append((func, args, kwargs)) -+ else: -+ # Python < 3.14 uses C array -+ callbacks = get_atexit_callbacks_array(atexit) -+ for idx in range(atexit._ncallbacks()): -+ callback = callbacks[idx][0] -+ if callback.kwargs: -+ kwargs = callback.kwargs -+ else: -+ kwargs = {} -+ exithandlers.append((callback.func, -+ callback.args, -+ kwargs)) - return exithandlers - - -@@ -203,6 +251,9 @@ def _set_exithandlers(exithandlers): - - # We could do this more efficiently by directly rebuilding the array - # of atexit_callbacks, but this is much simpler -+ # Note: exithandlers is in registration order (FIFO). -+ # In Python 3.14+, atexit.register prepends to the list (LIFO), -+ # so registering in forward order gives us the correct execution order. - for callback in exithandlers: - atexit.register(callback[0], *callback[1], **callback[2]) - diff --git a/srcpkgs/sagemath/patches/41141-Fix_ipython_9.7.0.patch b/srcpkgs/sagemath/patches/41141-Fix_ipython_9.7.0.patch deleted file mode 100644 index 5f05574f06a237..00000000000000 --- a/srcpkgs/sagemath/patches/41141-Fix_ipython_9.7.0.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 18efb69e53590586b22dd0f63559845d4676feeb Mon Sep 17 00:00:00 2001 -From: Chenxin Zhong -Date: Thu, 6 Nov 2025 21:56:57 +0800 -Subject: [PATCH] Removed the unicode_to_str conversion from the - SagePrettyPrinter initialization. - -Removed the unicode_to_str conversion from the SagePrettyPrinter initialization. ---- - src/sage/repl/display/formatter.py | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/src/sage/repl/display/formatter.py b/src/sage/repl/display/formatter.py -index 3b73674dd48..ceea50f36eb 100644 ---- a/src/sage/repl/display/formatter.py -+++ b/src/sage/repl/display/formatter.py -@@ -62,7 +62,6 @@ - from io import StringIO - - from IPython.core.formatters import DisplayFormatter, PlainTextFormatter --from IPython.utils.py3compat import unicode_to_str - from IPython.core.display import DisplayObject - - from ipywidgets import Widget -@@ -311,7 +310,7 @@ def __call__(self, obj): - print('---- calling ipython formatter ----') - stream = StringIO() - printer = SagePrettyPrinter( -- stream, self.max_width, unicode_to_str(self.newline)) -+ stream, self.max_width, self.newline) - printer.pretty(obj) - printer.flush() - return stream.getvalue() diff --git a/srcpkgs/sagemath/patches/41342-Fix_a_test_failure_with_numpy_2.4.patch b/srcpkgs/sagemath/patches/41342-Fix_a_test_failure_with_numpy_2.4.patch new file mode 100644 index 00000000000000..7b8241e9ecc130 --- /dev/null +++ b/srcpkgs/sagemath/patches/41342-Fix_a_test_failure_with_numpy_2.4.patch @@ -0,0 +1,13 @@ +diff --git a/src/sage/calculus/desolvers.py b/src/sage/calculus/desolvers.py +index 7f6ba7967e1..89a56cb54e1 100644 +--- a/src/sage/calculus/desolvers.py ++++ b/src/sage/calculus/desolvers.py +@@ -1621,7 +1621,7 @@ def desolve_odeint_inner(ivar): + assert len(des) == 1 + dvar = dvars[0] + de = des[0] +- func = fast_float(de, dvar, ivar) ++ func = lambda y, t: fast_float(de, dvar, ivar)(y.item(), t) + if not compute_jac: + Dfun = None + else: diff --git a/srcpkgs/sagemath/patches/41395-Fix_test_failures_with_pyparsing_3.3.patch b/srcpkgs/sagemath/patches/41395-Fix_test_failures_with_pyparsing_3.3.patch new file mode 100644 index 00000000000000..6bd2ae34b5cba4 --- /dev/null +++ b/srcpkgs/sagemath/patches/41395-Fix_test_failures_with_pyparsing_3.3.patch @@ -0,0 +1,22 @@ +diff --git a/src/sage/topology/simplicial_set_examples.py b/src/sage/topology/simplicial_set_examples.py +index be7a4084be2..cd69adb9c5a 100644 +--- a/src/sage/topology/simplicial_set_examples.py ++++ b/src/sage/topology/simplicial_set_examples.py +@@ -655,7 +655,7 @@ def simplicial_data_from_kenzo_output(filename) -> dict: + sage: S4.homology(reduced=False) # needs pyparsing + {0: Z, 1: 0, 2: 0, 3: 0, 4: Z} + """ +- from pyparsing import OneOrMore, nestedExpr ++ from pyparsing import OneOrMore, nested_expr + + with open(filename) as f: + data = f.read() +@@ -675,7 +675,7 @@ def simplicial_data_from_kenzo_output(filename) -> dict: + end = new_dim_idx + if dim == 0: + simplex_string = data[data.find('Vertices :') + len('Vertices :'):end] +- vertices = OneOrMore(nestedExpr()).parseString(simplex_string).asList()[0] ++ vertices = OneOrMore(nested_expr()).parse_string(simplex_string).asList()[0] + for v in vertices: + vertex = AbstractSimplex(0, name=v) + simplex_data[vertex] = None diff --git a/srcpkgs/sagemath/patches/get_patches b/srcpkgs/sagemath/patches/get_patches index 91a07391d35cd4..b034b4d37a7151 100755 --- a/srcpkgs/sagemath/patches/get_patches +++ b/srcpkgs/sagemath/patches/get_patches @@ -1,6 +1,6 @@ #! /bin/sh -version=10.7 +version=10.8 URL_BASE_PR="https://github.com/sagemath/sage/pull/" URL_BASE_COMPARE="https://github.com/sagemath/sage/compare/${version}..." @@ -30,7 +30,11 @@ get_pr() { # run from patches dir cd $(dirname "$0") -# positive review -get_pr 40594 "Fix segfault in libgap" -get_pr 41021 "Refactor atexit.pyx for python 3.14" -get_pr 41141 "Fix compatibility issue for ipython 9.7.0" +# merged/positive review + +get_pr 41395 "Fix test failures with pyparsing 3.3" +get_pr 41342 "Fix a test failure with numpy 2.4" + +# draft + +get_pr 40816 "Meson: Build docs for Maxima as well" diff --git a/srcpkgs/sagemath/patches/sphinx.patch b/srcpkgs/sagemath/patches/sphinx.patch deleted file mode 100644 index be52a132cbcd16..00000000000000 --- a/srcpkgs/sagemath/patches/sphinx.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- a/sage/sagemath_standard.egg-info/PKG-INFO -+++ b/sage/sagemath_standard.egg-info/PKG-INFO -@@ -39,7 +39,7 @@ Requires-Dist: requests>=2.13.0 - Requires-Dist: typing_extensions>=4.4.0; python_version < "3.11" - Requires-Dist: ipython>=7.13.0 - Requires-Dist: pexpect>=4.8.0 --Requires-Dist: sphinx<9,>=5.2 -+Requires-Dist: sphinx<10,>=5.2 - Requires-Dist: networkx>=2.4 - Requires-Dist: scipy>=1.12 - Requires-Dist: sympy<2.0,>=1.6 ---- a/sage/sagemath_standard.egg-info/requires.txt -+++ b/sage/sagemath_standard.egg-info/requires.txt -@@ -12,7 +12,7 @@ primecountpy>=0.1.1 - requests>=2.13.0 - ipython>=7.13.0 - pexpect>=4.8.0 --sphinx<9,>=5.2 -+sphinx<10,>=5.2 - networkx>=2.4 - scipy>=1.12 - sympy<2.0,>=1.6 ---- a/sage/setup.cfg -+++ b/sage/setup.cfg -@@ -46,7 +46,7 @@ install_requires = - typing_extensions >= 4.4.0; python_version<'3.11' - ipython >=7.13.0 - pexpect >=4.8.0 -- sphinx >=5.2, <9 -+ sphinx >=5.2, <10 - networkx >=2.4 - scipy >=1.12 - sympy >=1.6, <2.0 diff --git a/srcpkgs/sagemath/template b/srcpkgs/sagemath/template index 800fe7adf4448e..5231b46cb58eb5 100644 --- a/srcpkgs/sagemath/template +++ b/srcpkgs/sagemath/template @@ -1,14 +1,15 @@ # Template file for 'sagemath' pkgname=sagemath -version=10.7 -revision=4 +version=10.8 +revision=1 _pypi_version=${version/.beta/b} _pypi_version=${_pypi_version/.rc/rc} build_style=python3-pep517 +make_build_args="-C setup-args=-Dbuild-docs=false" hostmakedepends="pkg-config python3-Cython python3-Jinja2 python3-pkgconfig python3-setuptools python3-wheel python3-gmpy2 python3-memory_allocator python3-numpy ecl - python3-cypari2 python3-cysignals python3-devel" + python3-cypari2 python3-cysignals python3-devel python3-meson-python" makedepends="boost-headers brial-devel cliquer-devel ecl eclib-devel ecm-devel fflas-ffpack flintlib-devel gap-devel gd-devel glpk-devel gsl-devel iml-devel lcalc-devel libbraiding-devel libhomfly-devel libmpc-devel @@ -17,7 +18,7 @@ makedepends="boost-headers brial-devel cliquer-devel ecl eclib-devel python3-cysignals python3-devel python3-gmpy2 python3-memory_allocator python3-numpy rankwidth-devel singular symmetrica-devel" depends="eclib-devel fflas-ffpack flintlib-devel gcc-fortran meson gd-devel - gfan gsl-devel gzip libpng-devel linbox-devel m4ri-devel maxima-ecl + gfan gsl-devel gzip libpng-devel linbox-devel m4ri-devel maxima-ecl maxima-src mpfr-devel nauty ntl-devel palp pari-devel pari-elldata-small pari-galdata pari-galpol-small pari-seadata-small pkg-config python3-Cython python3-cypari2 python3-cysignals python3-devel python3-fpylll python3-ipython python3-lrcalc @@ -28,22 +29,20 @@ depends="eclib-devel fflas-ffpack flintlib-devel gcc-fortran meson gd-devel python3-conway-polynomials sage-data-elliptic_curves sage-data-graphs sage-data-polytopes_db sympow tachyon threejs-sage python3-six python3-gmpy2 python3-numpy python3-pexpect python3-Sphinx - python3-Pillow python3-mpmath python3-jupyter_client python3-ptyprocess" -checkdepends="$depends python3-pytest pythran python3-Sphinx gdb" + python3-Pillow python3-mpmath python3-jupyter_client python3-ptyprocess + python3-platformdirs" +checkdepends="${depends} python3-pytest pythran python3-Sphinx gdb" short_desc="Open source mathematics software" maintainer="Gonzalo TornarĂ­a " license="GPL-2.0-or-later" homepage="https://www.sagemath.org/" changelog="https://github.com/sagemath/sage/releases" -distfiles="${PYPI_SITE}/s/sagemath-standard/sagemath_standard-${_pypi_version}.tar.gz" -checksum=f6ec41913a745b94e20ceae69c2c54a7c8e549b3dc8b4a01dbd874c772924149 +distfiles="${PYPI_SITE}/s/sagemath/sagemath-${_pypi_version}.tar.gz" +checksum=864c21a84bfad05f586ccdc45bf685552cd87a236bf56bc30163de474569f82c nocross="due to ntl (eclib, singular), fflas-ffpack, givaro, linbox, sympow, maxima" -# main repo `.../src/sage/` is `.../sage/` here -patch_args=-Np2 - # parallel build -export SAGE_NUM_THREADS="$XBPS_MAKEJOBS" +export SAGE_NUM_THREADS="${XBPS_MAKEJOBS}" post_install() { # move scripts to /usr/libexec @@ -74,16 +73,16 @@ do_check() { fi cp ${FILESDIR}/timings2.json . _test_args="--stats_path=timings2.json" - if [ "$XBPS_CHECK_PKGS" = full ]; then + if [ "${XBPS_CHECK_PKGS}" = full ]; then _test_args+=" --long --warn-long 30.0" else _test_args+=" --warn-long 10.0" fi - if [ "$XBPS_BUILD_ENVIRONMENT" = "void-packages-ci" ]; then + if [ "${XBPS_BUILD_ENVIRONMENT}" = "void-packages-ci" ]; then # for CI use a predictable random seed _test_args+=" --random-seed=0" fi PATH="${testdir}/usr/bin:${PATH}" PYTHONPATH="${testdir}/${py3_sitelib}" \ - sage -tp ${XBPS_MAKEJOBS} ${_test_args} ${_test_files} + python3 -m sage.doctest -p ${XBPS_MAKEJOBS} ${_test_args} ${_test_files} }