Skip to content

Commit ebcf4ac

Browse files
committed
Revert "sagemath: update to 10.8."
This reverts commit 8ef6e07.
1 parent 2e49a9e commit ebcf4ac

File tree

6 files changed

+284
-56
lines changed

6 files changed

+284
-56
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
diff --git a/src/sage/libs/gap/element.pyx b/src/sage/libs/gap/element.pyx
2+
index f52a73c2ded..2ef40fd0a69 100644
3+
--- a/src/sage/libs/gap/element.pyx
4+
+++ b/src/sage/libs/gap/element.pyx
5+
@@ -2498,11 +2498,17 @@ cdef class GapElement_Function(GapElement):
6+
cdef Obj result = NULL
7+
cdef Obj arg_list
8+
cdef int n = len(args)
9+
- cdef volatile Obj v2
10+
-
11+
- if n > 0 and n <= 3:
12+
- libgap = self.parent()
13+
- a = [x if isinstance(x, GapElement) else libgap(x) for x in args]
14+
+ cdef Obj a[3]
15+
+
16+
+ if n <= 3:
17+
+ if not all(isinstance(x, GapElement) for x in args):
18+
+ libgap = self.parent()
19+
+ args = tuple(x if isinstance(x, GapElement) else libgap(x) for x in args)
20+
+ for i in range(n):
21+
+ x = args[i]
22+
+ a[i] = (<GapElement>x).value
23+
+ else:
24+
+ arg_list = make_gap_list(args)
25+
26+
try:
27+
sig_GAP_Enter()
28+
@@ -2510,20 +2516,12 @@ cdef class GapElement_Function(GapElement):
29+
if n == 0:
30+
result = GAP_CallFunc0Args(self.value)
31+
elif n == 1:
32+
- result = GAP_CallFunc1Args(self.value,
33+
- (<GapElement>a[0]).value)
34+
+ result = GAP_CallFunc1Args(self.value, a[0])
35+
elif n == 2:
36+
- result = GAP_CallFunc2Args(self.value,
37+
- (<GapElement>a[0]).value,
38+
- (<GapElement>a[1]).value)
39+
+ result = GAP_CallFunc2Args(self.value, a[0], a[1])
40+
elif n == 3:
41+
- v2 = (<GapElement>a[2]).value
42+
- result = GAP_CallFunc3Args(self.value,
43+
- (<GapElement>a[0]).value,
44+
- (<GapElement>a[1]).value,
45+
- v2)
46+
+ result = GAP_CallFunc3Args(self.value, a[0], a[1], a[2])
47+
else:
48+
- arg_list = make_gap_list(args)
49+
result = GAP_CallFuncList(self.value, arg_list)
50+
sig_off()
51+
finally:

srcpkgs/sagemath/patches/40816.patch

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
diff --git a/src/sage/cpython/atexit.pyx b/src/sage/cpython/atexit.pyx
2+
index c74c1d0308a..e6ecad9eadc 100644
3+
--- a/src/sage/cpython/atexit.pyx
4+
+++ b/src/sage/cpython/atexit.pyx
5+
@@ -144,51 +144,99 @@ cdef class restore_atexit:
6+
_set_exithandlers(self._exithandlers)
7+
8+
from cpython.ref cimport PyObject
9+
+import sys
10+
11+
-# Implement "_atexit_callbacks()" for each supported python version
12+
+# Implement a uniform interface for getting atexit callbacks
13+
cdef extern from *:
14+
"""
15+
+ #ifndef Py_BUILD_CORE
16+
#define Py_BUILD_CORE
17+
+ #endif
18+
#undef _PyGC_FINALIZED
19+
#include "internal/pycore_interp.h"
20+
#include "internal/pycore_pystate.h"
21+
- #if PY_VERSION_HEX >= 0x030c0000
22+
- // struct atexit_callback was renamed in 3.12 to atexit_py_callback
23+
- #define atexit_callback atexit_py_callback
24+
- #endif
25+
- static atexit_callback ** _atexit_callbacks(PyObject *self) {
26+
+
27+
+ // Always define this struct for Cython's use
28+
+ typedef struct {
29+
+ PyObject *func;
30+
+ PyObject *args;
31+
+ PyObject *kwargs;
32+
+ } atexit_callback_struct;
33+
+
34+
+ #if PY_VERSION_HEX >= 0x030e0000
35+
+ // Python 3.14+: atexit uses a PyList
36+
+ static PyObject* get_atexit_callbacks_list(PyObject *self) {
37+
PyInterpreterState *interp = _PyInterpreterState_GET();
38+
struct atexit_state state = interp->atexit;
39+
return state.callbacks;
40+
}
41+
+
42+
+ // Dummy function for Python 3.14+ (never called)
43+
+ static atexit_callback_struct** get_atexit_callbacks_array(PyObject *self) {
44+
+ PyErr_SetString(PyExc_RuntimeError, "Python >= 3.14 has no atexit array");
45+
+ return NULL;
46+
+ }
47+
+ #else
48+
+ // Python < 3.14: atexit uses C array
49+
+ static atexit_callback_struct** get_atexit_callbacks_array(PyObject *self) {
50+
+ PyInterpreterState *interp = _PyInterpreterState_GET();
51+
+ struct atexit_state state = interp->atexit;
52+
+ // Cast from atexit_callback** to our struct type
53+
+ return (atexit_callback_struct**)state.callbacks;
54+
+ }
55+
+
56+
+ // Dummy function for Python < 3.14 (never called)
57+
+ static PyObject* get_atexit_callbacks_list(PyObject *self) {
58+
+ PyErr_SetString(PyExc_RuntimeError, "Python < 3.14 has no atexit list");
59+
+ return NULL;
60+
+ }
61+
+ #endif
62+
"""
63+
- ctypedef struct atexit_callback:
64+
+ # Declare both functions - they exist in all Python versions (one is dummy)
65+
+ object get_atexit_callbacks_list(object module)
66+
+
67+
+ ctypedef struct atexit_callback_struct:
68+
PyObject* func
69+
PyObject* args
70+
PyObject* kwargs
71+
- atexit_callback** _atexit_callbacks(object module)
72+
+ atexit_callback_struct** get_atexit_callbacks_array(object module) except NULL
73+
74+
75+
def _get_exithandlers():
76+
"""Return list of exit handlers registered with the atexit module."""
77+
- cdef atexit_callback ** callbacks
78+
- cdef atexit_callback callback
79+
- cdef list exithandlers
80+
+ cdef list exithandlers = []
81+
+ cdef atexit_callback_struct ** callbacks
82+
+ cdef atexit_callback_struct callback
83+
cdef int idx
84+
cdef object kwargs
85+
-
86+
- exithandlers = []
87+
- callbacks = _atexit_callbacks(atexit)
88+
-
89+
- for idx in range(atexit._ncallbacks()):
90+
- callback = callbacks[idx][0]
91+
- if callback.kwargs:
92+
- kwargs = <object>callback.kwargs
93+
- else:
94+
- kwargs = {}
95+
- exithandlers.append((<object>callback.func,
96+
- <object>callback.args,
97+
- kwargs))
98+
+
99+
+ # Python 3.14+ uses a PyList directly
100+
+ if sys.version_info >= (3, 14):
101+
+ callbacks_list = get_atexit_callbacks_list(atexit)
102+
+ if callbacks_list is None:
103+
+ return exithandlers
104+
+ # callbacks is a list of tuples: [(func, args, kwargs), ...]
105+
+ # Normalize kwargs to ensure it's always a dict (not None)
106+
+ # Note: In Python 3.14+, atexit stores callbacks in LIFO order
107+
+ # (most recently registered first), but we return them in FIFO
108+
+ # order (registration order) for consistency with earlier versions
109+
+ for item in reversed(callbacks_list):
110+
+ func, args, kwargs = item
111+
+ if kwargs is None:
112+
+ kwargs = {}
113+
+ exithandlers.append((func, args, kwargs))
114+
+ else:
115+
+ # Python < 3.14 uses C array
116+
+ callbacks = get_atexit_callbacks_array(atexit)
117+
+ for idx in range(atexit._ncallbacks()):
118+
+ callback = callbacks[idx][0]
119+
+ if callback.kwargs:
120+
+ kwargs = <object>callback.kwargs
121+
+ else:
122+
+ kwargs = {}
123+
+ exithandlers.append((<object>callback.func,
124+
+ <object>callback.args,
125+
+ kwargs))
126+
return exithandlers
127+
128+
129+
@@ -203,6 +251,9 @@ def _set_exithandlers(exithandlers):
130+
131+
# We could do this more efficiently by directly rebuilding the array
132+
# of atexit_callbacks, but this is much simpler
133+
+ # Note: exithandlers is in registration order (FIFO).
134+
+ # In Python 3.14+, atexit.register prepends to the list (LIFO),
135+
+ # so registering in forward order gives us the correct execution order.
136+
for callback in exithandlers:
137+
atexit.register(callback[0], *callback[1], **callback[2])
138+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
From 18efb69e53590586b22dd0f63559845d4676feeb Mon Sep 17 00:00:00 2001
2+
From: Chenxin Zhong <[email protected]>
3+
Date: Thu, 6 Nov 2025 21:56:57 +0800
4+
Subject: [PATCH] Removed the unicode_to_str conversion from the
5+
SagePrettyPrinter initialization.
6+
7+
Removed the unicode_to_str conversion from the SagePrettyPrinter initialization.
8+
---
9+
src/sage/repl/display/formatter.py | 3 +--
10+
1 file changed, 1 insertion(+), 2 deletions(-)
11+
12+
diff --git a/src/sage/repl/display/formatter.py b/src/sage/repl/display/formatter.py
13+
index 3b73674dd48..ceea50f36eb 100644
14+
--- a/src/sage/repl/display/formatter.py
15+
+++ b/src/sage/repl/display/formatter.py
16+
@@ -62,7 +62,6 @@
17+
from io import StringIO
18+
19+
from IPython.core.formatters import DisplayFormatter, PlainTextFormatter
20+
-from IPython.utils.py3compat import unicode_to_str
21+
from IPython.core.display import DisplayObject
22+
23+
from ipywidgets import Widget
24+
@@ -311,7 +310,7 @@ def __call__(self, obj):
25+
print('---- calling ipython formatter ----')
26+
stream = StringIO()
27+
printer = SagePrettyPrinter(
28+
- stream, self.max_width, unicode_to_str(self.newline))
29+
+ stream, self.max_width, self.newline)
30+
printer.pretty(obj)
31+
printer.flush()
32+
return stream.getvalue()
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
--- a/sage/sagemath_standard.egg-info/PKG-INFO
2+
+++ b/sage/sagemath_standard.egg-info/PKG-INFO
3+
@@ -39,7 +39,7 @@ Requires-Dist: requests>=2.13.0
4+
Requires-Dist: typing_extensions>=4.4.0; python_version < "3.11"
5+
Requires-Dist: ipython>=7.13.0
6+
Requires-Dist: pexpect>=4.8.0
7+
-Requires-Dist: sphinx<9,>=5.2
8+
+Requires-Dist: sphinx<10,>=5.2
9+
Requires-Dist: networkx>=2.4
10+
Requires-Dist: scipy>=1.12
11+
Requires-Dist: sympy<2.0,>=1.6
12+
--- a/sage/sagemath_standard.egg-info/requires.txt
13+
+++ b/sage/sagemath_standard.egg-info/requires.txt
14+
@@ -12,7 +12,7 @@ primecountpy>=0.1.1
15+
requests>=2.13.0
16+
ipython>=7.13.0
17+
pexpect>=4.8.0
18+
-sphinx<9,>=5.2
19+
+sphinx<10,>=5.2
20+
networkx>=2.4
21+
scipy>=1.12
22+
sympy<2.0,>=1.6
23+
--- a/sage/setup.cfg
24+
+++ b/sage/setup.cfg
25+
@@ -46,7 +46,7 @@ install_requires =
26+
typing_extensions >= 4.4.0; python_version<'3.11'
27+
ipython >=7.13.0
28+
pexpect >=4.8.0
29+
- sphinx >=5.2, <9
30+
+ sphinx >=5.2, <10
31+
networkx >=2.4
32+
scipy >=1.12
33+
sympy >=1.6, <2.0

srcpkgs/sagemath/template

Lines changed: 30 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,49 @@
11
# Template file for 'sagemath'
22
pkgname=sagemath
3-
version=10.8
4-
revision=1
3+
version=10.7
4+
revision=4
55
_pypi_version=${version/.beta/b}
66
_pypi_version=${_pypi_version/.rc/rc}
77
build_style=python3-pep517
8-
make_build_args="-C setup-args=-Dbuild-docs=false"
9-
hostmakedepends="pkg-config
10-
python3-Jinja2 python3-pkgconfig python3-setuptools
11-
python3-wheel python3-meson-python"
8+
hostmakedepends="pkg-config python3-Cython python3-Jinja2
9+
python3-pkgconfig python3-setuptools python3-wheel
10+
python3-gmpy2 python3-memory_allocator python3-numpy ecl
11+
python3-cypari2 python3-cysignals python3-devel"
1212
makedepends="boost-headers brial-devel cliquer-devel ecl eclib-devel
1313
ecm-devel fflas-ffpack flintlib-devel gap-devel gd-devel glpk-devel
1414
gsl-devel iml-devel lcalc-devel libbraiding-devel libhomfly-devel libmpc-devel
1515
libpng-devel linbox-devel m4ri-devel m4rie-devel mpfi-devel
16-
mpfr-devel ntl-devel openblas-devel pari-devel planarity-devel
17-
singular symmetrica-devel rankwidth-devel
18-
maxima-ecl maxima-src nauty gfan gcc-fortran palp
19-
sympow tachyon threejs-sage
20-
pari-elldata-small pari-galdata
21-
pari-galpol-small pari-seadata-small
22-
sage-data-combinatorial_designs
23-
sage-data-combinatorial_designs
24-
sage-data-elliptic_curves
25-
sage-data-graphs
26-
sage-data-polytopes_db
27-
python3-cypari2 python3-cysignals python3-devel python3-gmpy2
28-
python3-memory_allocator python3-numpy python3-Cython
29-
python3-fpylll python3-ipython python3-lrcalc
16+
mpfr-devel ntl-devel openblas-devel pari-devel planarity-devel python3-cypari2
17+
python3-cysignals python3-devel python3-gmpy2 python3-memory_allocator
18+
python3-numpy rankwidth-devel singular symmetrica-devel"
19+
depends="eclib-devel fflas-ffpack flintlib-devel gcc-fortran meson gd-devel
20+
gfan gsl-devel gzip libpng-devel linbox-devel m4ri-devel maxima-ecl
21+
mpfr-devel nauty ntl-devel palp pari-devel pari-elldata-small pari-galdata
22+
pari-galpol-small pari-seadata-small pkg-config python3-Cython python3-cypari2
23+
python3-cysignals python3-devel python3-fpylll python3-ipython python3-lrcalc
3024
python3-ipython_ipykernel python3-jupyter_ipywidgets python3-matplotlib
31-
python3-networkx python3-pip
25+
python3-memory_allocator python3-networkx python3-pip python3-pkgconfig
3226
python3-pplpy python3-primecountpy python3-requests python3-scipy
33-
python3-sympy python3-traitlets
34-
python3-conway-polynomials
35-
python3-six python3-pexpect python3-Sphinx
36-
python3-Pillow python3-mpmath python3-jupyter_client python3-ptyprocess
37-
python3-platformdirs python3-pytest"
38-
depends="gzip
39-
python3-Cython python3-Pillow python3-Sphinx python3-conway-polynomials
40-
python3-cypari2 python3-cysignals python3-fpylll python3-gmpy2
41-
python3-ipython python3-ipython_ipykernel python3-jupyter_client
42-
python3-jupyter_ipywidgets python3-matplotlib python3-memory_allocator
43-
python3-mpmath python3-networkx python3-numpy python3-pexpect
44-
python3-pkgconfig python3-platformdirs python3-pplpy python3-primecountpy
45-
python3-ptyprocess python3-requests python3-scipy python3-six
46-
python3-sympy python3-traitlets
47-
python3-lrcalc"
48-
checkdepends="${depends} python3-pytest pythran gdb"
27+
python3-sympy python3-traitlets sage-data-combinatorial_designs
28+
python3-conway-polynomials sage-data-elliptic_curves sage-data-graphs
29+
sage-data-polytopes_db sympow tachyon threejs-sage
30+
python3-six python3-gmpy2 python3-numpy python3-pexpect python3-Sphinx
31+
python3-Pillow python3-mpmath python3-jupyter_client python3-ptyprocess"
32+
checkdepends="$depends python3-pytest pythran python3-Sphinx gdb"
4933
short_desc="Open source mathematics software"
5034
maintainer="Gonzalo Tornaría <[email protected]>"
5135
license="GPL-2.0-or-later"
5236
homepage="https://www.sagemath.org/"
5337
changelog="https://github.com/sagemath/sage/releases"
54-
distfiles="${PYPI_SITE}/s/sagemath/sagemath-${_pypi_version}.tar.gz"
55-
checksum=864c21a84bfad05f586ccdc45bf685552cd87a236bf56bc30163de474569f82c
38+
distfiles="${PYPI_SITE}/s/sagemath-standard/sagemath_standard-${_pypi_version}.tar.gz"
39+
checksum=f6ec41913a745b94e20ceae69c2c54a7c8e549b3dc8b4a01dbd874c772924149
5640
nocross="due to ntl (eclib, singular), fflas-ffpack, givaro, linbox, sympow, maxima"
5741

42+
# main repo `.../src/sage/` is `.../sage/` here
43+
patch_args=-Np2
44+
5845
# parallel build
59-
export SAGE_NUM_THREADS="${XBPS_MAKEJOBS}"
46+
export SAGE_NUM_THREADS="$XBPS_MAKEJOBS"
6047

6148
post_install() {
6249
# move scripts to /usr/libexec
@@ -87,16 +74,16 @@ do_check() {
8774
fi
8875
cp ${FILESDIR}/timings2.json .
8976
_test_args="--stats_path=timings2.json"
90-
if [ "${XBPS_CHECK_PKGS}" = full ]; then
77+
if [ "$XBPS_CHECK_PKGS" = full ]; then
9178
_test_args+=" --long --warn-long 30.0"
9279
else
9380
_test_args+=" --warn-long 10.0"
9481
fi
95-
if [ "${XBPS_BUILD_ENVIRONMENT}" = "void-packages-ci" ]; then
82+
if [ "$XBPS_BUILD_ENVIRONMENT" = "void-packages-ci" ]; then
9683
# for CI use a predictable random seed
9784
_test_args+=" --random-seed=0"
9885
fi
9986

10087
PATH="${testdir}/usr/bin:${PATH}" PYTHONPATH="${testdir}/${py3_sitelib}" \
101-
python3 -m sage.doctest -p ${XBPS_MAKEJOBS} ${_test_args} ${_test_files}
88+
sage -tp ${XBPS_MAKEJOBS} ${_test_args} ${_test_files}
10289
}

0 commit comments

Comments
 (0)