sage: 10.7 -> 10.9

This commit is contained in:
Mauricio Collares
2026-05-26 08:50:08 -03:00
parent 166e16038c
commit a4277219ac
9 changed files with 392 additions and 209 deletions
@@ -0,0 +1,89 @@
diff --git a/src/sage/config.py.in b/src/sage/config.py.in
index 3a95538d313..f75e951f3b8 100644
--- a/src/sage/config.py.in
+++ b/src/sage/config.py.in
@@ -48,6 +48,11 @@ FOURTITWO_PPI = "@FOURTITWO_PPI@"
FOURTITWO_CIRCUITS = "@FOURTITWO_CIRCUITS@"
FOURTITWO_GROEBNER = "@FOURTITWO_GROEBNER@"
+# Colon-separated list of pkg-config modules to search for cblas functionality.
+# We hard-code it here as cblas because configure (build/pkgs/openblas/spkg-configure.m4)
+# always provides cblas.pc, if necessary by creating a facade pc file for a system BLAS.
+CBLAS_PC_MODULES = "cblas"
+
# for sage_setup.setenv
SAGE_ARCHFLAGS = "@SAGE_ARCHFLAGS@"
SAGE_PKG_CONFIG_PATH = "@SAGE_PKG_CONFIG_PATH@".replace("$SAGE_LOCAL", SAGE_LOCAL)
diff --git a/src/sage/env.py b/src/sage/env.py
index f6c198a8617..dc45d11fb46 100644
--- a/src/sage/env.py
+++ b/src/sage/env.py
@@ -218,6 +218,7 @@ FOURTITWO_RAYS = var("FOURTITWO_RAYS")
FOURTITWO_PPI = var("FOURTITWO_PPI")
FOURTITWO_CIRCUITS = var("FOURTITWO_CIRCUITS")
FOURTITWO_GROEBNER = var("FOURTITWO_GROEBNER")
+CBLAS_PC_MODULES = var("CBLAS_PC_MODULES", "cblas:openblas:blas")
ECL_CONFIG = var("ECL_CONFIG", "ecl-config")
NTL_INCDIR = var("NTL_INCDIR")
NTL_LIBDIR = var("NTL_LIBDIR")
@@ -322,8 +323,17 @@ def sage_include_directories(use_sources=False):
return dirs
+def get_cblas_pc_module_name() -> str:
+ """
+ Return the name of the BLAS libraries to be used.
+ """
+ import pkgconfig
+ cblas_pc_modules = CBLAS_PC_MODULES.split(':')
+ return next(blas_lib for blas_lib in cblas_pc_modules if pkgconfig.exists(blas_lib))
+
+
default_required_modules = ('fflas-ffpack', 'givaro', 'gsl', 'linbox', 'Singular',
- 'libpng', 'gdlib', 'm4ri', 'zlib', 'ecl')
+ 'libpng', 'gdlib', 'm4ri', 'zlib', 'cblas', 'ecl')
default_optional_modules = ('lapack',)
@@ -348,7 +358,7 @@ def cython_aliases(required_modules=None, optional_modules=None):
sage: cython_aliases()
{...}
sage: sorted(cython_aliases().keys())
- ['ECL_CFLAGS',
+ ['CBLAS_CFLAGS',
...,
'ZLIB_LIBRARIES']
sage: cython_aliases(required_modules=('module-that-is-assumed-to-not-exist'))
@@ -395,6 +405,8 @@ def cython_aliases(required_modules=None, optional_modules=None):
for lib, required in itertools.chain(((lib, True) for lib in required_modules),
((lib, False) for lib in optional_modules)):
var = lib.upper().replace("-", "") + "_"
+ if lib == 'cblas':
+ lib = get_cblas_pc_module_name()
if lib == 'zlib':
aliases[var + "CFLAGS"] = ""
try:
diff --git a/src/sage/misc/cython.py b/src/sage/misc/cython.py
index 6d30189ae89..830a744c1aa 100644
--- a/src/sage/misc/cython.py
+++ b/src/sage/misc/cython.py
@@ -50,12 +50,16 @@ def _standard_libs_libdirs_incdirs_aliases():
{...})
"""
aliases = cython_aliases()
- standard_libs = ["mpfr", "gmp", "gmpxx", "pari", "m", "ec", "gsl", "ntl"]
+ standard_libs = [
+ 'mpfr', 'gmp', 'gmpxx', 'pari', 'm',
+ 'ec', 'gsl',
+ ] + aliases["CBLAS_LIBRARIES"] + [
+ 'ntl']
standard_libdirs = []
if SAGE_LOCAL:
standard_libdirs.append(os.path.join(SAGE_LOCAL, "lib"))
- standard_libdirs.extend(aliases["NTL_LIBDIR"])
- standard_incdirs = [dir.as_posix() for dir in get_include_dirs()] + aliases["NTL_INCDIR"]
+ standard_libdirs.extend(aliases["CBLAS_LIBDIR"] + aliases["NTL_LIBDIR"])
+ standard_incdirs = [dir.as_posix() for dir in get_include_dirs()] + aliases["CBLAS_INCDIR"] + aliases["NTL_INCDIR"]
return standard_libs, standard_libdirs, standard_incdirs, aliases
################################################################
@@ -0,0 +1,14 @@
diff --git a/src/sage_docbuild/sphinxbuild.py b/src/sage_docbuild/sphinxbuild.py
index 62b2d3cb112..df4665982e8 100644
--- a/src/sage_docbuild/sphinxbuild.py
+++ b/src/sage_docbuild/sphinxbuild.py
@@ -107,7 +107,8 @@ class SageSphinxLogger():
re.compile('WARNING: Any IDs not assiend for figure node'),
re.compile('WARNING: .* is not referenced'),
re.compile('WARNING: Build finished'),
- re.compile('WARNING: rST localisation for language .* not found')
+ re.compile('WARNING: rST localisation for language .* not found'),
+ re.compile('WARNING: error while formatting arguments for .*')
)
# The warning "unknown config value 'multidoc_first_pass'..."
# should only appear when building the documentation for a
@@ -0,0 +1,129 @@
diff --git a/src/doc/en/reference/repl/meson.build b/src/doc/en/reference/repl/meson.build
index eb492404897..9b162becf3b 100644
--- a/src/doc/en/reference/repl/meson.build
+++ b/src/doc/en/reference/repl/meson.build
@@ -9,10 +9,3 @@ doc_sources = [
foreach file : doc_sources
doc_src += fs.copyfile(file)
endforeach
-
-doc_src_repl = custom_target(
- 'options',
- output: ['options.txt'],
- command: [py, src / 'sage' / 'cli', '--help'],
- capture: true,
-)
diff --git a/src/doc/meson.build b/src/doc/meson.build
index 1f33822cf5f..5ba1ab0397b 100644
--- a/src/doc/meson.build
+++ b/src/doc/meson.build
@@ -1,11 +1,21 @@
-if not get_option('build-docs')
- subdir_done()
-endif
-
-warning(
- 'Documentation building enabled, generating targets may be slow. To disable this, pass -Dbuild-docs=false.',
+project(
+ 'SageMath',
+ ['c', 'cpp', 'cython'],
+ version: '10.9',
+ license: 'GPL v3',
+ default_options: ['c_std=c17', 'cpp_std=c++17', 'python.install_env=auto'],
+ meson_version: '>=1.5',
)
+src = meson.current_source_dir()
+fs = import('fs')
+
+# Python module
+# https://mesonbuild.com/Python-module.html
+py_module = import('python')
+py = py_module.find_installation(pure: false)
+py_dep = py.dependency()
+
sphinx_check = py_module.find_installation(required: false, modules: ['sphinx'])
if not sphinx_check.found()
warning(
@@ -35,21 +45,17 @@ doc_bootstrap = custom_target(
'bootstrap',
output: ['autogen'],
command: [
- py,
- files('../../tools/bootstrap-docs.py'),
+ 'sage',
+ '-python',
+ files('bootstrap-docs.py'),
meson.current_build_dir(),
],
- env: {'SAGE_ROOT': root},
- # doc_src is not really a dependency of the bootstrap, but we want to make sure
- # that all the source files are present before running the actual doc build
- # so let's collect all source-related targets here.
- depends: doc_src,
)
references = run_command(
- py,
[
- src / 'build-docs.py',
+ 'sage',
+ '--docbuild',
'--no-prune-empty-dirs',
'--all-documents',
'reference',
@@ -71,10 +77,7 @@ foreach type : ['inventory', 'html', 'pdf']
short_ref = ref
endif
deps = []
- deps += doc_bootstrap
- if short_ref == 'repl'
- deps += doc_src_repl
- endif
+ deps += doc_bootstrap
if type == 'html' or type == 'pdf'
deps += reference_inventory
endif
@@ -93,8 +96,8 @@ foreach type : ['inventory', 'html', 'pdf']
'doc-' + type + '-reference-' + short_ref,
output: [type + short_ref],
command: [
- py,
- src / 'build-docs.py',
+ 'sage',
+ '--docbuild',
'--no-prune-empty-dirs',
'--no-pdf-links',
ref,
@@ -120,9 +123,9 @@ foreach type : ['inventory', 'html', 'pdf']
endforeach
other_documents = run_command(
- py,
[
- src / 'build-docs.py',
+ 'sage',
+ '--docbuild',
'--no-prune-empty-dirs',
'--all-documents',
'all',
@@ -140,8 +143,8 @@ foreach type : ['html', 'pdf']
'doc-' + type + '-other-' + short_doc,
output: [type + short_doc],
command: [
- py,
- src / 'build-docs.py',
+ 'sage',
+ '--docbuild',
'--no-prune-empty-dirs',
'--no-pdf-links',
doc,
diff --git a/src/meson.build b/src/meson.build
index 039cbbd1294..dfb82d980fb 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -309,4 +309,3 @@ src = meson.current_source_dir()
# Submodules
subdir('sage')
-subdir('doc')
@@ -1,30 +0,0 @@
diff --git a/src/sage_docbuild/builders.py b/src/sage_docbuild/builders.py
index 91035a01f1c..24f3d0c7c12 100644
--- a/src/sage_docbuild/builders.py
+++ b/src/sage_docbuild/builders.py
@@ -130,10 +130,9 @@ def builder_helper(type):
logger.debug(build_command)
# Run Sphinx with Sage's special logger
- sys.argv = ["sphinx-build"] + build_command.split()
- from .sphinxbuild import runsphinx
+ args = "python3 -um sage_docbuild.sphinxbuild -N".split() + build_command.split()
try:
- runsphinx()
+ subprocess.check_call(args)
except Exception:
if build_options.ABORT_ON_ERROR:
raise
diff --git a/src/sage_docbuild/sphinxbuild.py b/src/sage_docbuild/sphinxbuild.py
index 62b2d3cb112..aa7dc07741b 100644
--- a/src/sage_docbuild/sphinxbuild.py
+++ b/src/sage_docbuild/sphinxbuild.py
@@ -331,3 +331,8 @@ def runsphinx():
if not sys.warnoptions:
warnings.filters = original_filters[:]
+
+if __name__ == '__main__':
+ import sys
+ sys.argv[0] = "sphinx-build"
+ runsphinx()
@@ -0,0 +1,32 @@
diff --git a/src/sage/config.py.in b/src/sage/config.py.in
index 3a95538d313..cdd551122fc 100644
--- a/src/sage/config.py.in
+++ b/src/sage/config.py.in
@@ -4,6 +4,8 @@ import sage
VERSION = "@PACKAGE_VERSION@"
+SAGE_BUILD_SRC = "@EDITABLE_SRC@/src"
+
# The following must not be used during build to determine source or installation
# location of sagelib. See comments in SAGE_ROOT/src/Makefile.in
# These variables come first so that other substituted variable values can refer
diff --git a/src/sage/misc/sageinspect.py b/src/sage/misc/sageinspect.py
index c237af52c24..7a8e8291406 100644
--- a/src/sage/misc/sageinspect.py
+++ b/src/sage/misc/sageinspect.py
@@ -270,6 +270,14 @@ def _extract_embedded_position(docstring):
return None
raw_filename = res.group('FILENAME')
+
+ # remove SAGE_BUILD_SRC prefix to workaround
+ # https://github.com/cython/cython/pull/6755
+ from sage.config import SAGE_BUILD_SRC
+ from os.path import commonprefix, relpath
+ if commonprefix([raw_filename, SAGE_BUILD_SRC]) == SAGE_BUILD_SRC:
+ raw_filename = relpath(raw_filename, SAGE_BUILD_SRC)
+
filename = raw_filename
if not os.path.isabs(filename):
+53 -75
View File
@@ -7,6 +7,7 @@
env-locations,
gfortran,
ninja,
meson,
bash,
coreutils,
gnused,
@@ -66,6 +67,7 @@ let
pythonEnv
gfortran # for inline fortran
ninja # for inline fortran via numpy.f2py
meson # for inline fortran
stdenv.cc # for cython
bash
coreutils
@@ -129,84 +131,60 @@ writeTextFile rec {
m4ri
]
}'
export SAGE_ROOT='${sagelib.src}'
''
+
# TODO: is using pythonEnv instead of @sage-local@ here a good
# idea? there is a test in src/sage/env.py that checks if the values
# SAGE_ROOT and SAGE_LOCAL set here match the ones set in env.py.
# we fix up env.py's SAGE_ROOT in sage-src.nix (which does not
# have access to sage-with-env), but env.py autodetects
# SAGE_LOCAL to be pythonEnv.
# setting SAGE_LOCAL to pythonEnv also avoids having to create
# python3, ipython, ipython3 and jupyter symlinks in
# sage-with-env.nix.
''
export SAGE_LOCAL='${pythonEnv}'
export PATH="${runtimepath}:$PATH"
export SAGE_DOC="''${SAGE_DOC_OVERRIDE:-doc-placeholder}"
export SAGE_DOC_SRC="''${SAGE_DOC_SRC_OVERRIDE:-${sagelib.src}/src/doc}"
export SAGE_SHARE='${sagelib}/share'
export SAGE_ENV_CONFIG_SOURCED=1 # sage-env complains if sage-env-config is not sourced beforehand
orig_path="$PATH"
export PATH='${runtimepath}'
# set locations of dependencies
. ${env-locations}/sage-env-locations
# set dependent vars, like JUPYTER_CONFIG_DIR
source "${sagelib.src}/src/bin/sage-env"
export PATH="$RUNTIMEPATH_PREFIX:${runtimepath}:$orig_path" # sage-env messes with PATH
# needed for cython
export CC='${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc'
export CXX='${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++'
# cython needs to find these libraries, otherwise will fail with `ld: cannot find -lflint` or similar
export LDFLAGS='${
lib.concatStringsSep " " (
map (pkg: "-L${pkg}/lib") [
flint
gap
glpk
gmp
mpfr
pari
zlib
eclib
gsl
ntl
sympow
]
)
}'
export CFLAGS='${
lib.concatStringsSep " " (
map (pkg: "-isystem ${pkg}/include") [
singular
gmp.dev
glpk
flint
gap
mpfr.dev
]
)
}'
export CXXFLAGS=$CFLAGS
export SAGE_LOGS="$TMPDIR/sage-logs"
export SAGE_DOC="''${SAGE_DOC_OVERRIDE:-doc-placeholder}"
export SAGE_DOC_SRC="''${SAGE_DOC_SRC_OVERRIDE:-${sagelib.src}/src/doc}"
export SAGE_LIB='${sagelib}/${python3.sitePackages}'
# set locations of dependencies
. ${env-locations}/sage-env-locations
export SAGE_EXTCODE='${sagelib.src}/src/sage/ext_data'
# needed for cython
export CC='${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc'
export CXX='${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++'
# cython needs to find these libraries, otherwise will fail with `ld: cannot find -lflint` or similar
export LDFLAGS='${
lib.concatStringsSep " " (
map (pkg: "-L${pkg}/lib") [
flint
gap
glpk
gmp
mpfr
pari
zlib
eclib
gsl
ntl
sympow
]
)
}'
export CFLAGS='${
lib.concatStringsSep " " (
map (pkg: "-isystem ${pkg}/include") [
singular
gmp.dev
glpk
flint
gap
mpfr.dev
]
)
}'
export CXXFLAGS=$CFLAGS
export SAGE_LIB='${sagelib}/${python3.sitePackages}'
export SAGE_EXTCODE='${sagelib.src}/src/sage/ext_data'
# for find_library
export DYLD_LIBRARY_PATH="${
lib.makeLibraryPath [
stdenv.cc.libc
singular
giac
gap
]
}''${DYLD_LIBRARY_PATH:+:}$DYLD_LIBRARY_PATH"
'';
# for find_library
export DYLD_LIBRARY_PATH="${
lib.makeLibraryPath [
stdenv.cc.libc
singular
giac
gap
]
}''${DYLD_LIBRARY_PATH:+:}$DYLD_LIBRARY_PATH"
'';
}
+45 -72
View File
@@ -12,14 +12,14 @@
# all get the same sources with the same patches applied.
stdenv.mkDerivation rec {
version = "10.7";
version = "10.9";
pname = "sage-src";
src = fetchFromGitHub {
owner = "sagemath";
repo = "sage";
rev = version;
hash = "sha256-nYlBmKQ9TD5EAVvNwo8YzqAd5IUCpTU3kBTqUH21IxQ=";
hash = "sha256-8IBCQYdmL7ane7/WOoogArbwgqPDtL8ecz9GIzuEfOU=";
};
# contains essential files (e.g., setup.cfg) generated by the bootstrap script.
@@ -27,21 +27,39 @@ stdenv.mkDerivation rec {
configure-src = fetchurl {
# the hash below is the tagged commit's _parent_. it can also be found by looking for
# the "configure" asset at https://github.com/sagemath/sage/releases/tag/${version}
url = "mirror://sageupstream/configure/configure-858268b40010e5ed6da13488ad0f52cda4d1f70e.tar.gz";
hash = "sha256-TsVX+wUWr+keCXmGQp1OHGXgNc7luajyGxfTwduSEtc=";
url = "mirror://sageupstream/configure/configure-8592858fd4c0eb936cfa9ebf704d165f6b857617.tar.gz";
hash = "sha256-jakdc+4S/2uRooEaXMlNZpo01dVBumVp7HHHP4iZu0c=";
};
# Patches needed because of particularities of nix or the way this is packaged.
# The goal is to upstream all of them and get rid of this list.
nixPatches = [
# Parallelize docubuild using subprocesses, fixing an isolation issue. See
# https://groups.google.com/forum/#!topic/sage-packaging/YGOm8tkADrE
./patches/sphinx-docbuild-subprocesses.patch
# After updating smypow to (https://github.com/sagemath/sage/issues/3360)
# we can now set the cache dir to be within the .sage directory. This is
# not strictly necessary, but keeps us from littering in the user's HOME.
./patches/sympow-cache.patch
# MILD HACK: Turn src/doc/meson.build into a standalone project, so we can
# docbuild separately.
./patches/sagedoc-standalone-meson.patch
# Silence some warnings during docbuild. Imported from Arch.
./patches/sagedoc-silence-formatting-warnings.patch
# Workaround for https://github.com/cython/cython/pull/6755, adapted from Void. Can be removed after next Cython release.
./patches/workaround-cython-relpaths.patch
# Revert https://github.com/sagemath/sage/pull/40520. It causes
# "undefined symbol: cblas_ctrmv" errors.
./patches/revert-blas-mesonification.patch
# https://github.com/sagemath/sage/pull/41637 causes problems when
# docbuilding.
(fetchpatch2 {
url = "https://github.com/sagemath/sage/commit/854ea0e546ee24ff09072ee77550b944b54f697c.patch?full_index=1";
revert = true;
hash = "sha256-j5evAmOtKEG4OVFb/w/SVY2vvP5BSkqHBDmnroh8XY0=";
})
]
++ lib.optionals (stdenv.cc.isClang) [
# https://github.com/NixOS/nixpkgs/pull/264126
@@ -60,11 +78,11 @@ stdenv.mkDerivation rec {
# a more conservative version of https://github.com/sagemath/sage/pull/37951
./patches/gap-element-crash.patch
# https://github.com/sagemath/sage/pull/40895, landed in 10.8.beta6
# https://github.com/sagemath/sage/pull/42009, landed in 10.10.beta0
(fetchpatch2 {
name = "doctest-absolute-path.patch";
url = "https://github.com/sagemath/sage/commit/3a5904d43f552bf63ed1eed9154f87b1f0de53fb.patch?full_index=1";
hash = "sha256-rp+9d8Y6kifWzufE07GWU68txPn//w7uMn4LcpITaBs=";
name = "gap-root-paths.patch";
url = "https://github.com/sagemath/sage/commit/24c9605a770b2419cd401bf6c8780bb4be923244.patch?full_index=1";
hash = "sha256-68w2HWLR6mb13BWi5Fb6SfPAqPbdJrns0l5T6SoMqNI=";
})
];
@@ -75,63 +93,6 @@ stdenv.mkDerivation rec {
# should come from or be proposed to upstream. This list will probably never
# be empty since dependencies update all the time.
packageUpgradePatches = [
# https://github.com/sagemath/sage/pull/40919, landed in 10.8.beta8
(fetchpatch2 {
name = "gap-4.15.1-update.patch";
url = "https://github.com/sagemath/sage/commit/54d4ddb132cc71ef26b4db1f48afd6736d41cc63.patch?full_index=1";
hash = "sha256-PZyOXRsgcsPvgceGGZXet5URJgWiIlCfFx8tvwpLk5A=";
excludes = [ "src/doc/zh/constructions/rep_theory.rst" ];
})
# https://github.com/sagemath/sage/pull/41141, landed in 10.8.beta9
(fetchpatch2 {
name = "ipython-9_7_0-unicode_to_str.patch";
url = "https://github.com/sagemath/sage/commit/fa00696112fde95e0c4241ad6063936200ce6f68.patch?full_index=1";
hash = "sha256-eFDpNu/2gcQATELmQ7/VzXI35xIzaVrD8bhhJ57e2gc=";
})
# https://github.com/sagemath/sage/pull/41233, landed in 10.8.rc0
(fetchpatch2 {
name = "flint-3.4-update.patch";
url = "https://github.com/sagemath/sage/commit/9bd5304f1a222e215d7006a04854ff66616748bf.patch?full_index=1";
hash = "sha256-7bgouXV3pM20IX5PM24ZpJWOBlZjQksGtjopgouEbyg=";
})
# https://github.com/sagemath/sage/pull/41078, landed in 10.8.beta8
(fetchpatch2 {
name = "docutils-0.22-update.patch";
url = "https://github.com/sagemath/sage/commit/e206e205a6841cc5251dfb37fdd36ed29345fba4.patch?full_index=1";
hash = "sha256-Y8DqwGBkRnL+6ejZibCmkEJ7q/Qs0wD2KGmAefVdd94=";
})
# https://github.com/sagemath/sage/pull/41342, landed in 10.9.beta1
(fetchpatch2 {
name = "numpy-2.4-update.patch";
url = "https://github.com/sagemath/sage/commit/97ceea842a39fa2f2e9098daae2738a2f2765b9e.patch?full_index=1";
hash = "sha256-/Tk3tIy0syOjaNRMCyot6kma3jj4288QJ3zypS79jZo=";
})
# https://github.com/sagemath/sage/pull/41346, landed in 10.9.beta2
(fetchpatch2 {
name = "ipython-9.8-updte.patch";
url = "https://github.com/sagemath/sage/commit/380949e6eeda80cca6e5dd971e2c6f367647a863.patch?full_index=1";
hash = "sha256-e4zmgfHrenOixgbUS1uFHzftmwNGGoSb7yFhYmqT0yc=";
})
# https://github.com/sagemath/sage/pull/41395, landed in 10.9.beta2
(fetchpatch2 {
name = "pyparsing-3.3-update.patch";
url = "https://github.com/sagemath/sage/commit/1b5a5dd78b5dcb4b3c7d1f94461ddbc647c5679f.patch?full_index=1";
hash = "sha256-kFXg2O3IpwaOwAaNIy6Wscx8/XSDWXrqAXS2ZJgdqsg=";
})
# https://github.com/sagemath/sage/pull/41433, landed in 10.9.beta3
(fetchpatch2 {
name = "scipy-1.17-update.patch";
url = "https://github.com/sagemath/sage/commit/ff58afe27c80c067a8965e1d70966e25d0355aaf.patch?full_index=1";
hash = "sha256-gWoXwhUVXL2RSVLPRbxtlP0LCSEkJ9z1PJ1wKLXef1k=";
})
# https://github.com/sagemath/sage/pull/42089, landed in 10.10.beta0
(fetchpatch2 {
name = "flint-3.5.0-update.patch";
@@ -158,16 +119,28 @@ stdenv.mkDerivation rec {
"s|var(\"SAGE_ROOT\".*|var(\"SAGE_ROOT\", \"$out\")|" \
src/sage/env.py
# https://github.com/sagemath/sage/pull/40489 removed this file,
# but it seems like autogen/interpreters/internal/__init__.py
# was not fully adapted for that, and it causes fast_callable problems
touch src/sage/ext/all.py
# HACK: meson tries to run maxima at build time. that's not necessary
# because we ensure Sage will find all it needs at runtime.
sed -i 's/not is_windows/false/g' src/sage/meson.build
sed -i 's/if not maxima_present/if false/g' src/sage/libs/meson.build
sed -i '/SAGE_MAXIMA/d' src/sage/libs/meson.build
# sage --docbuild unsets JUPYTER_PATH, which breaks our docbuilding
# https://trac.sagemath.org/ticket/33650#comment:32
sed -i "/export JUPYTER_PATH/d" src/bin/sage
'';
buildPhase = "# do nothing";
buildPhase = ''
tar xzf ${configure-src}
rm configure
'';
installPhase = ''
cp -r . "$out"
tar xzf ${configure-src} -C "$out"
rm "$out/configure"
'';
}
+21 -5
View File
@@ -12,15 +12,31 @@ stdenv.mkDerivation rec {
strictDeps = true;
nativeBuildInputs = with python3.pkgs; [
meson-python
cython
sphinx
];
unpackPhase = ''
export SAGE_DOC_OVERRIDE="$PWD/share/doc/sage"
export SAGE_DOC_SRC_OVERRIDE="$PWD/docsrc"
cp -r "${src}/src/doc" "$SAGE_DOC_SRC_OVERRIDE"
chmod -R 755 "$SAGE_DOC_SRC_OVERRIDE"
# Tools needed for meson to run the bootstrap script
cp -r "${src}/tools/bootstrap-docs.py" "$SAGE_DOC_SRC_OVERRIDE"
cp -r "${src}/build/sage_bootstrap" "$SAGE_DOC_SRC_OVERRIDE"
chmod -R 755 "$SAGE_DOC_SRC_OVERRIDE/sage_bootstrap/env.py"
sed "/assert/d" "${src}/build/sage_bootstrap/env.py" > "$SAGE_DOC_SRC_OVERRIDE/sage_bootstrap/env.py"
'';
preBuild = ''
preConfigure = ''
cd docsrc
'';
buildPhase = ''
export SAGE_ROOT="${sage-with-env.env.lib.src}"
export PATH="${sage-with-env}/bin:$PATH"
export HOME="$TMPDIR/sage_home"
@@ -32,10 +48,10 @@ stdenv.mkDerivation rec {
# jupyter-sphinx calls the sagemath jupyter kernel during docbuild
export JUPYTER_PATH=${jupyter-kernel-specs}
# the Makefile tries to guess SAGE_DOC, but in a buggy way (changed in 10.8)
export SAGE_DOC="$SAGE_DOC_OVERRIDE"
cd docsrc
meson setup $SAGE_DOC_OVERRIDE
meson compile -C $SAGE_DOC_OVERRIDE
sage -advanced > $SAGE_DOC_OVERRIDE/en/reference/repl/options.txt
meson compile -C $SAGE_DOC_OVERRIDE doc-html
'';
enableParallelBuilding = true;
+9 -27
View File
@@ -9,6 +9,7 @@
perl,
pkg-config,
sage-setup,
sage-docbuild,
setuptools,
gd,
iml,
@@ -73,6 +74,7 @@
pplpy,
primecountpy,
ptyprocess,
pytest,
requests,
rpy2,
scipy,
@@ -103,10 +105,8 @@ buildPythonPackage rec {
pkg-config
sage-setup
setuptools
];
pythonRelaxDeps = [
"sphinx"
meson-python
cython
];
buildInputs = [
@@ -115,6 +115,8 @@ buildPythonPackage rec {
libpng
];
mesonFlags = [ "-Dbuild-docs=false" ];
env = lib.optionalAttrs stdenv.cc.isClang {
# code tries to assign a unsigned long to an int in an initialized list
# leading to this error.
@@ -175,7 +177,6 @@ buildPythonPackage rec {
lrcalc-python
matplotlib
memory-allocator
meson-python
mpmath
networkx
numpy
@@ -186,8 +187,10 @@ buildPythonPackage rec {
pplpy
primecountpy
ptyprocess
pytest
requests
rpy2
sage-docbuild
scipy
sphinx
sympy
@@ -195,28 +198,7 @@ buildPythonPackage rec {
];
preBuild = ''
export SAGE_ROOT="$PWD"
export SAGE_LOCAL="$SAGE_ROOT"
export SAGE_SHARE="$SAGE_LOCAL/share"
# set locations of dependencies (needed for nbextensions like threejs)
. ${env-locations}/sage-env-locations
export JUPYTER_PATH="$SAGE_LOCAL/jupyter"
export PATH="$SAGE_ROOT/build/bin:$SAGE_ROOT/src/bin:$PATH"
export SAGE_NUM_THREADS="$NIX_BUILD_CORES"
mkdir -p "$SAGE_SHARE/sage/ext/notebook-ipython"
mkdir -p "var/lib/sage/installed"
sed -i "/sage-conf/d" src/{setup.cfg,pyproject.toml,requirements.txt}
cd build/pkgs/sagelib/src
'';
postInstall = ''
rm -r "$out/${python.sitePackages}/sage/cython_debug"
patchShebangs src/sage_setup/autogen/interpreters/__main__.py
'';
doCheck = false; # we will run tests in sage-tests.nix