1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 21:20:33 +02:00

gnu: Add sage.

* gnu/packages/sagemath.scm (sage): New variable.
(conway-polynomials, graphs, polytopes-db): Make packages private.
* gnu/packages/patches/sage-update-eclib.patch,
gnu/packages/patches/sage-update-pari-gp.patch: New files.
* gnu/local.mk (dist_patch_DATA): Register patches.

Change-Id: I1cf647760ea3af2dd01d11eedbf1e847a2175365
This commit is contained in:
Andreas Enge
2025-02-08 10:58:04 +01:00
parent 328b4e30c6
commit b58c78093e
4 changed files with 5418 additions and 5 deletions

View File

@@ -2204,6 +2204,8 @@ dist_patch_DATA = \
%D%/packages/patches/rw-igraph-0.10.patch \
%D%/packages/patches/rxvt-unicode-fix-cursor-position.patch \
%D%/packages/patches/s7-flint-3.patch \
%D%/packages/patches/sage-update-eclib.patch \
%D%/packages/patches/sage-update-pari-gp.patch \
%D%/packages/patches/sajson-for-gemmi-numbers-as-strings.patch \
%D%/packages/patches/sajson-build-with-gcc10.patch \
%D%/packages/patches/sbc-fix-build-non-x86.patch \

View File

@@ -0,0 +1,222 @@
From 6dfc26b805d2fb0cafa60f0d778db3d68188b724 Mon Sep 17 00:00:00 2001
From: John Cremona <john.cremona@gmail.com>
Date: Wed, 13 Nov 2024 14:46:51 +0000
Subject: [PATCH 1/4] #38960-eclib-upgrade-20241112
---
build/pkgs/eclib/SPKG.rst | 2 +-
build/pkgs/eclib/checksums.ini | 4 ++--
build/pkgs/eclib/package-version.txt | 2 +-
build/pkgs/eclib/spkg-configure.m4 | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/build/pkgs/eclib/SPKG.rst b/build/pkgs/eclib/SPKG.rst
index 5627fdcb57c..ac8b27b3606 100644
--- a/build/pkgs/eclib/SPKG.rst
+++ b/build/pkgs/eclib/SPKG.rst
@@ -30,5 +30,5 @@ Upstream Contact
- Author: John Cremona
- Email: john.cremona@gmail.com
- Website:
- http://homepages.warwick.ac.uk/staff/J.E.Cremona/mwrank/index.html
+ https://johncremona.github.io/mwrank/index.html
- Repository: https://github.com/JohnCremona/eclib
diff --git a/build/pkgs/eclib/checksums.ini b/build/pkgs/eclib/checksums.ini
index fde4faaee15..b046783341d 100644
--- a/build/pkgs/eclib/checksums.ini
+++ b/build/pkgs/eclib/checksums.ini
@@ -1,4 +1,4 @@
tarball=eclib-VERSION.tar.bz2
-sha1=3028ac95e1b76699f5f9e871ac706cda363ab842
-sha256=32d116a3e359b0de4f6486c2bb6188bb8b553c8b833f618cc2596484e8b6145a
+sha1=749e4fda3660006a9459f129148d05ba482daa29
+sha256=30765c27ca1420141f83517897119d0185fea9b31132392170ddae40b060e46f
upstream_url=https://github.com/JohnCremona/eclib/releases/download/vVERSION/eclib-VERSION.tar.bz2
diff --git a/build/pkgs/eclib/package-version.txt b/build/pkgs/eclib/package-version.txt
index 190b92f716b..353869c3cba 100644
--- a/build/pkgs/eclib/package-version.txt
+++ b/build/pkgs/eclib/package-version.txt
@@ -1 +1 @@
-20231212
+20241112
diff --git a/build/pkgs/eclib/spkg-configure.m4 b/build/pkgs/eclib/spkg-configure.m4
index ba5c22fa090..23771dad1bd 100644
--- a/build/pkgs/eclib/spkg-configure.m4
+++ b/build/pkgs/eclib/spkg-configure.m4
@@ -1,7 +1,7 @@
SAGE_SPKG_CONFIGURE([eclib], [
SAGE_SPKG_DEPCHECK([ntl pari flint], [
dnl use existing eclib only if the version reported by pkg-config is recent enough
- m4_pushdef([SAGE_ECLIB_VER],["20231212"])
+ m4_pushdef([SAGE_ECLIB_VER],["20241112"])
PKG_CHECK_MODULES([ECLIB], [eclib >= SAGE_ECLIB_VER], [
AC_CACHE_CHECK([for mwrank version == SAGE_ECLIB_VER], [ac_cv_path_MWRANK], [
AC_PATH_PROGS_FEATURE_CHECK([MWRANK], [mwrank], [
From d38cb48c67c7565572064fd29748c1e8da3b3271 Mon Sep 17 00:00:00 2001
From: John Cremona <john.cremona@gmail.com>
Date: Tue, 19 Nov 2024 13:51:49 +0000
Subject: [PATCH 2/4] #38960 fix eclib interface after upgrade
---
src/sage/libs/eclib/__init__.pxd | 4 ++--
src/sage/libs/eclib/mat.pyx | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/sage/libs/eclib/__init__.pxd b/src/sage/libs/eclib/__init__.pxd
index d44d4fba865..84d1fc92275 100644
--- a/src/sage/libs/eclib/__init__.pxd
+++ b/src/sage/libs/eclib/__init__.pxd
@@ -55,7 +55,7 @@ cdef extern from "eclib/matrix.h":
cdef cppclass mat:
mat()
mat(mat m)
- scalar* get_entries()
+ vector[scalar] get_entries()
scalar sub(long, long)
long nrows()
long ncols()
@@ -67,7 +67,7 @@ cdef extern from "eclib/smatrix.h":
cdef cppclass smat:
smat()
smat(smat m)
- scalar* get_entries()
+ vector[scalar] get_entries()
scalar sub(long, long)
long nrows()
long ncols()
diff --git a/src/sage/libs/eclib/mat.pyx b/src/sage/libs/eclib/mat.pyx
index bfdeb6ae5c1..e7abe369b2b 100644
--- a/src/sage/libs/eclib/mat.pyx
+++ b/src/sage/libs/eclib/mat.pyx
@@ -10,7 +10,7 @@ from sage.rings.integer_ring import ZZ
from sage.matrix.matrix_integer_sparse cimport Matrix_integer_sparse
from sage.matrix.matrix_integer_dense cimport Matrix_integer_dense
from sage.rings.integer cimport Integer
-
+from libcpp.vector cimport vector
cdef class Matrix:
"""
@@ -213,7 +213,7 @@ cdef class Matrix:
"""
cdef long n = self.nrows()
cdef long i, j, k
- cdef scalar* v = <scalar*> self.M.get_entries() # coercion needed to deal with const
+ cdef vector[scalar] v = <vector[scalar]> self.M.get_entries() # coercion needed to deal with const
cdef Matrix_integer_dense Td
cdef Matrix_integer_sparse Ts
From 4f2cb3f7a943aefd05d4baf7b5845a6fc3dba779 Mon Sep 17 00:00:00 2001
From: John Cremona <john.cremona@gmail.com>
Date: Wed, 4 Dec 2024 08:35:58 +0000
Subject: [PATCH 3/4] #38960 simplify eclib interface
---
src/sage/libs/eclib/__init__.pxd | 2 --
src/sage/libs/eclib/mat.pyx | 18 +++++++-----------
2 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/src/sage/libs/eclib/__init__.pxd b/src/sage/libs/eclib/__init__.pxd
index 84d1fc92275..2673af0613f 100644
--- a/src/sage/libs/eclib/__init__.pxd
+++ b/src/sage/libs/eclib/__init__.pxd
@@ -55,7 +55,6 @@ cdef extern from "eclib/matrix.h":
cdef cppclass mat:
mat()
mat(mat m)
- vector[scalar] get_entries()
scalar sub(long, long)
long nrows()
long ncols()
@@ -67,7 +66,6 @@ cdef extern from "eclib/smatrix.h":
cdef cppclass smat:
smat()
smat(smat m)
- vector[scalar] get_entries()
scalar sub(long, long)
long nrows()
long ncols()
diff --git a/src/sage/libs/eclib/mat.pyx b/src/sage/libs/eclib/mat.pyx
index e7abe369b2b..5dbb39faa0e 100644
--- a/src/sage/libs/eclib/mat.pyx
+++ b/src/sage/libs/eclib/mat.pyx
@@ -10,7 +10,6 @@ from sage.rings.integer_ring import ZZ
from sage.matrix.matrix_integer_sparse cimport Matrix_integer_sparse
from sage.matrix.matrix_integer_dense cimport Matrix_integer_dense
from sage.rings.integer cimport Integer
-from libcpp.vector cimport vector
cdef class Matrix:
"""
@@ -212,8 +211,7 @@ cdef class Matrix:
<class 'sage.matrix.matrix_integer_dense.Matrix_integer_dense'>
"""
cdef long n = self.nrows()
- cdef long i, j, k
- cdef vector[scalar] v = <vector[scalar]> self.M.get_entries() # coercion needed to deal with const
+ cdef long i, j
cdef Matrix_integer_dense Td
cdef Matrix_integer_sparse Ts
@@ -221,21 +219,19 @@ cdef class Matrix:
# Ugly code...
if sparse:
Ts = MatrixSpace(ZZ, n, sparse=sparse).zero_matrix().__copy__()
- k = 0
for i from 0 <= i < n:
for j from 0 <= j < n:
- if v[k]:
- Ts.set_unsafe(i, j, Integer(v[k]))
- k += 1
+ Mij = Integer(self.M.sub(i+1,j+1));
+ if Mij:
+ Ts.set_unsafe(i, j, Mij)
return Ts
else:
Td = MatrixSpace(ZZ, n, sparse=sparse).zero_matrix().__copy__()
- k = 0
for i from 0 <= i < n:
for j from 0 <= j < n:
- if v[k]:
- Td.set_unsafe(i, j, Integer(v[k]))
- k += 1
+ Mij = Integer(self.M.sub(i+1,j+1));
+ if Mij:
+ Td.set_unsafe(i, j, Mij)
return Td
From 8754c7052084043209c8332d3d1154c26c25ae91 Mon Sep 17 00:00:00 2001
From: John Cremona <john.cremona@gmail.com>
Date: Wed, 4 Dec 2024 09:20:07 +0000
Subject: [PATCH 4/4] #38960: fix lint issue
---
src/sage/libs/eclib/mat.pyx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/sage/libs/eclib/mat.pyx b/src/sage/libs/eclib/mat.pyx
index 5dbb39faa0e..989d9d1a70c 100644
--- a/src/sage/libs/eclib/mat.pyx
+++ b/src/sage/libs/eclib/mat.pyx
@@ -221,7 +221,7 @@ cdef class Matrix:
Ts = MatrixSpace(ZZ, n, sparse=sparse).zero_matrix().__copy__()
for i from 0 <= i < n:
for j from 0 <= j < n:
- Mij = Integer(self.M.sub(i+1,j+1));
+ Mij = Integer(self.M.sub(i+1,j+1))
if Mij:
Ts.set_unsafe(i, j, Mij)
return Ts
@@ -229,7 +229,7 @@ cdef class Matrix:
Td = MatrixSpace(ZZ, n, sparse=sparse).zero_matrix().__copy__()
for i from 0 <= i < n:
for j from 0 <= j < n:
- Mij = Integer(self.M.sub(i+1,j+1));
+ Mij = Integer(self.M.sub(i+1,j+1))
if Mij:
Td.set_unsafe(i, j, Mij)
return Td

File diff suppressed because it is too large Load Diff

View File

@@ -26,18 +26,24 @@
#:use-module (guix build-system python)
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (guix gexp)
#:use-module (guix packages)
#:use-module (guix utils)
#:use-module (gnu packages)
#:use-module (gnu packages algebra)
#:use-module (gnu packages autotools)
#:use-module (gnu packages base)
#:use-module (gnu packages bdw-gc)
#:use-module (gnu packages boost)
#:use-module (gnu packages check)
#:use-module (gnu packages compression)
#:use-module (gnu packages fontutils)
#:use-module (gnu packages gd)
#:use-module (gnu packages graph)
#:use-module (gnu packages image)
#:use-module (gnu packages maths)
#:use-module (gnu packages lisp)
#:use-module (gnu packages m4)
#:use-module (gnu packages maths)
#:use-module (gnu packages multiprecision)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages popt)
@@ -45,7 +51,6 @@
#:use-module (gnu packages python-build)
#:use-module (gnu packages python-xyz))
(define-public brial
(package
(name "brial")
@@ -285,7 +290,7 @@ libraries GMO, MPFR and MPC.")
Polyhedra Library (PPL).")
(license license:gpl3+)))
(define-public conway-polynomials
(define conway-polynomials
(package
(name "conway-polynomials")
(version "0.10")
@@ -306,7 +311,7 @@ polynomials. The aim of this package is to make them available through a
generic Python interface.")
(license license:gpl3+)))
(define-public polytopes-db
(define polytopes-db
(package
(name "polytopes-db")
(version "20170220")
@@ -328,7 +333,7 @@ to be used by SageMath.")
;; Debian says GPLv2+.
(license license:gpl2+)))
(define-public graphs
(define graphs
(package
(name "graphs")
(version "20210214")
@@ -351,3 +356,167 @@ to be used by SageMath.")
database.")
;; Debian says GPLv2+.
(license license:gpl2+)))
(define-public sage
(package
(name "sage")
(version "10.6.beta6")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/sagemath/sage")
(commit version)))
(file-name (git-file-name name version))
(sha256
(base32
"0w2v5c4k2khlpglaj9sq1vbs7q03ib3d46pgr6k4n3mclhsy2idk"))
(patches (search-patches "sage-update-eclib.patch"
"sage-update-pari-gp.patch"))))
(build-system pyproject-build-system)
(native-inputs
(list autoconf automake m4 pkg-config ; for ./bootstrap
python-cython-3
python-cysignals
python-memory-allocator
python-pkgconfig
python-jinja2
python-setuptools
python-wheel))
(propagated-inputs
(list ;; required to make the sage script start
python-ipython
python-ipywidgets
python-traitlets
;; required for the Jupyter notebook
python-jupyter-client
python-notebook))
(inputs
(list boost
brial
cliquer
conway-polynomials
coreutils
ecl
eclib
edge-addition-planarity-suite
fflas-ffpack
flint
fontconfig
freetype
gap
gd
giac
givaro
glpk
gmp
gmp-ecm
graphs
gsl
ijg-libjpeg
iml
lcalc
libbraiding
libhomfly
linbox
libpng
m4ri
m4rie
maxima-ecl
mpc
mpfi
mpfr
ntl
openblas
pari-gp
polytopes-db
python
python-cypari2
python-fpylll
python-gmpy2
python-numpy
python-pplpy
rw
sed
singular
symmetrica))
(arguments
(list
#:tests? #f ; Tests can be run using "make ptestlong", but it is
; expected that some of them fail.
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'patch-source
(lambda _
(let ((ecl #$(this-package-input "ecl"))
(ecm #$(this-package-input "gmp-ecm"))
(maxima #$(this-package-input "maxima-ecl"))
(maxima-version #$(package-version
(this-package-input "maxima-ecl")))
(singular #$(this-package-input "singular"))
(gap #$(this-package-input "gap"))
(pari-gp #$(this-package-input "pari-gp"))
(python #$(this-package-input "python"))
(coreutils #$(this-package-input "coreutils"))
(sed #$(this-package-input "sed"))
(graphs #$(this-package-input "graphs"))
(polytopes-db #$(this-package-input "polytopes-db")))
(substitute* (find-files "build/bin")
(("sage-bootstrap-python") "python"))
(substitute* "src/sage/env.py"
(("\"ecl-config\"")
(string-append "\"" ecl "/bin/ecl-config\""))
(("\"ecm\"")
(string-append "\"" ecm "/bin/ecm\""))
(("\"maxima\"")
(string-append "\"" maxima "/bin/maxima\""))
(("\"MAXIMA_FAS\"")
(string-append "\"MAXIMA_FAS\", \"" maxima
"/lib/maxima/" maxima-version
"/binary-ecl/maxima.fas\""))
(("\"Singular\"")
(string-append "\"" singular "/bin/Singular\""))
(("var\\('SAGE_GAP_COMMAND', None\\)")
(string-append "var('SAGE_GAP_COMMAND', \""
gap "/bin/gap\")"))
(("join\\(SAGE_LOCAL, \"lib\", \"gap\"\\)")
(string-append "\"" gap "/lib/gap\""))
(("join\\(SAGE_LOCAL, \"share\", \"gap\"\\)")
(string-append "\"" gap "/share/gap\""))
;; definition of SAGE_VENV, which ends up in kernel.json
(("os.path.abspath\\(sys.prefix\\)")
(string-append "\"" #$output "\""))
;; paths of the databases
(("GRAPHS_DATA_DIR\"")
(string-append
"GRAPHS_DATA_DIR\", "
"\"" graphs "/share/graphs\""))
(("POLYTOPE_DATA_DIR\"")
(string-append
"POLYTOPE_DATA_DIR\", "
"\"" polytopes-db "/share/reflexive_polytopes\"")))
(substitute* "src/sage/interfaces/gp.py"
(("command=f\"gp")
(string-append "command=f\"" pari-gp "/bin/gp")))
(substitute* "src/bin/sage"
(("exec python3")
(string-append "exec " python "/bin/python3"))
(("mkdir")
(string-append coreutils "/bin/mkdir"))
((" sed ")
(string-append " " sed "/bin/sed "))))))
(add-before 'build 'setup
(lambda _
(setenv "SAGE_NUM_THREADS"
(number->string (parallel-job-count)))
(invoke "./bootstrap")
(chdir "src")))
(delete 'sanity-check)))) ; does not reflect reality
(home-page "https://www.sagemath.org/")
(synopsis "SageMath computer algebra system")
(description
"SageMath is a mathematics software built on top of many existing
packages such as NumPy, SciPy, Matplotlib, Sympy, Maxima, GAP, FLINT,
R and others. Their combined power may be accessed through a common,
Python-based language or directly via interfaces or wrappers.")
;; Documentation under cc-by-sa3.0, see COPYING.txt in the distribution.
(license license:gpl3)))