···11-diff --git a/src/sage/env.py b/src/sage/env.py
22-index c4953cfa65..47b880f9ad 100644
33---- a/src/sage/env.py
44-+++ b/src/sage/env.py
55-@@ -244,81 +244,8 @@ os.environ['MPMATH_SAGE'] = '1'
66- SAGE_BANNER = var("SAGE_BANNER", "")
77- SAGE_IMPORTALL = var("SAGE_IMPORTALL", "yes")
88-99--
1010--def _get_shared_lib_path(*libnames: str) -> Optional[str]:
1111-- """
1212-- Return the full path to a shared library file installed in
1313-- ``$SAGE_LOCAL/lib`` or the directories associated with the
1414-- Python sysconfig.
1515--
1616-- This can also be passed more than one library name (e.g. for cases where
1717-- some library may have multiple names depending on the platform) in which
1818-- case the first one found is returned.
1919--
2020-- This supports most *NIX variants (in which ``lib<libname>.so`` is found
2121-- under ``$SAGE_LOCAL/lib``), macOS (same, but with the ``.dylib``
2222-- extension), and Cygwin (under ``$SAGE_LOCAL/bin/cyg<libname>.dll``,
2323-- or ``$SAGE_LOCAL/bin/cyg<libname>-*.dll`` for versioned DLLs).
2424--
2525-- For distributions like Debian that use a multiarch layout, we also try the
2626-- multiarch lib paths (i.e. ``/usr/lib/<arch>/``).
2727--
2828-- This returns ``None`` if no matching library file could be found.
2929--
3030-- EXAMPLES::
3131--
3232-- sage: from sage.env import _get_shared_lib_path
3333-- sage: "gap" in _get_shared_lib_path("gap")
3434-- True
3535-- sage: _get_shared_lib_path("an_absurd_lib") is None
3636-- True
3737--
3838-- """
3939--
4040-- for libname in libnames:
4141-- search_directories: List[Path] = []
4242-- patterns: List[str] = []
4343-- if sys.platform == 'cygwin':
4444-- # Later down we take the first matching DLL found, so search
4545-- # SAGE_LOCAL first so that it takes precedence
4646-- if SAGE_LOCAL:
4747-- search_directories.append(Path(SAGE_LOCAL) / 'bin')
4848-- search_directories.append(Path(sysconfig.get_config_var('BINDIR')))
4949-- # Note: The following is not very robust, since if there are multible
5050-- # versions for the same library this just selects one more or less
5151-- # at arbitrary. However, practically speaking, on Cygwin, there
5252-- # will only ever be one version
5353-- patterns = [f'cyg{libname}.dll', f'cyg{libname}-*.dll']
5454-- else:
5555-- if sys.platform == 'darwin':
5656-- ext = 'dylib'
5757-- else:
5858-- ext = 'so'
5959--
6060-- if SAGE_LOCAL:
6161-- search_directories.append(Path(SAGE_LOCAL) / 'lib')
6262-- libdir = sysconfig.get_config_var('LIBDIR')
6363-- if libdir is not None:
6464-- libdir = Path(libdir)
6565-- search_directories.append(libdir)
6666--
6767-- multiarchlib = sysconfig.get_config_var('MULTIARCH')
6868-- if multiarchlib is not None:
6969-- search_directories.append(libdir / multiarchlib),
7070--
7171-- patterns = [f'lib{libname}.{ext}']
7272--
7373-- for directory in search_directories:
7474-- for pattern in patterns:
7575-- path = next(directory.glob(pattern), None)
7676-- if path is not None:
7777-- return str(path.resolve())
7878--
7979-- # Just return None if no files were found
8080-- return None
8181--
8282- # locate libgap shared object
8383--GAP_SO = var("GAP_SO", _get_shared_lib_path("gap", ""))
8484-+GAP_SO = var("GAP_SO", '/default')
8585-8686- # post process
8787- if DOT_SAGE is not None and ' ' in DOT_SAGE:
···88# This is done because multiple derivations rely on these sources and they should
99# all get the same sources with the same patches applied.
10101111-let
1212- # Fetch a diff between `base` and `rev` on sage's git server.
1313- # Used to fetch trac tickets by setting the `base` to the last release and the
1414- # `rev` to the last commit of the ticket.
1515- #
1616- # We don't use sage's own build system (which builds all its
1717- # dependencies), so we exclude changes to "build/" from patches by
1818- # default to avoid conflicts.
1919- fetchSageDiff = { base, name, rev, sha256, squashed ? false, excludes ? [ "build/*" ]
2020- , ...}@args: (
2121- fetchpatch ({
2222- inherit name sha256 excludes;
2323-2424- # There are three places to get changes from:
2525- #
2626- # 1) From Sage's Trac. Contains all release tags (like "9.4") and all developer
2727- # branches (wip patches from tickets), but exports each commit as a separate
2828- # patch, so merge commits can lead to conflicts. Used if squashed == false.
2929- #
3030- # The above is the preferred option. To use it, find a Trac ticket and pass the
3131- # "Commit" field from the ticket as "rev", choosing "base" as an appropriate
3232- # release tag, i.e. a tag that doesn't cause the patch to include a lot of
3333- # unrelated changes. If there is no such tag (due to nonlinear history, for
3434- # example), there are two other options, listed below.
3535- #
3636- # 2) From GitHub's sagemath/sage repo. This lets us use a GH feature that allows
3737- # us to choose between a .patch file, with one patch per commit, or a .diff file,
3838- # which squashes all commits into a single diff. This is used if squashed ==
3939- # true. This repo has all release tags. However, it has no developer branches, so
4040- # this option can't be used if a change wasn't yet shipped in a (possibly beta)
4141- # release.
4242- #
4343- # 3) From GitHub's sagemath/sagetrac-mirror repo. Mirrors all developer branches,
4444- # but has no release tags. The only use case not covered by 1 or 2 is when we need
4545- # to apply a patch from an open ticket that contains merge commits.
4646- #
4747- # Item 3 could cover all use cases if the sagemath/sagetrack-mirror repo had
4848- # release tags, but it requires a sha instead of a release number in "base", which
4949- # is inconvenient.
5050- urls = if squashed
5151- then [
5252- "https://github.com/sagemath/sage/compare/${base}...${rev}.diff"
5353- "https://github.com/sagemath/sagetrac-mirror/compare/${base}...${rev}.diff"
5454- ]
5555- else [ "https://git.sagemath.org/sage.git/patch?id2=${base}&id=${rev}" ];
5656- } // builtins.removeAttrs args [ "rev" "base" "sha256" "squashed" "excludes" ])
5757- );
5858-in
5911stdenv.mkDerivation rec {
6060- version = "9.8";
1212+ version = "10.0";
6113 pname = "sage-src";
62146315 src = fetchFromGitHub {
6416 owner = "sagemath";
6517 repo = "sage";
6618 rev = version;
6767- sha256 = "sha256-dDbrzJXsOBARYfJz0r7n3LbaoXHnx7Acz6HBa95NV9o=";
1919+ sha256 = "sha256-zN/Lo/GBCjYGemuaYpgG3laufN8te3wPjXMQ+Me9zgY=";
6820 };
69217022 # Patches needed because of particularities of nix or the way this is packaged.
7123 # The goal is to upstream all of them and get rid of this list.
7224 nixPatches = [
7373- # Fixes a potential race condition which can lead to transient doctest failures.
7474- ./patches/fix-ecl-race.patch
7575-7676- # Not necessary since library location is set explicitly
7777- # https://trac.sagemath.org/ticket/27660#ticket
7878- ./patches/do-not-test-find-library.patch
7979-8025 # Parallelize docubuild using subprocesses, fixing an isolation issue. See
8126 # https://groups.google.com/forum/#!topic/sage-packaging/YGOm8tkADrE
8227 ./patches/sphinx-docbuild-subprocesses.patch
2828+2929+ # After updating smypow to (https://github.com/sagemath/sage/issues/3360)
3030+ # we can now set the cache dir to be within the .sage directory. This is
3131+ # not strictly necessary, but keeps us from littering in the user's HOME.
3232+ ./patches/sympow-cache.patch
8333 ];
84348535 # Since sage unfortunately does not release bugfix releases, packagers must
8636 # fix those bugs themselves. This is for critical bugfixes, where "critical"
8737 # == "causes (transient) doctest failures / somebody complained".
8838 bugfixPatches = [
8989- # To help debug the transient error in
9090- # https://trac.sagemath.org/ticket/23087 when it next occurs.
9191- ./patches/configurationpy-error-verbose.patch
3939+ # Sage uses mixed integer programs (MIPs) to find edge disjoint
4040+ # spanning trees. For some reason, aarch64 glpk takes much longer
4141+ # than x86_64 glpk to solve such MIPs. Since the MIP formulation
4242+ # has "numerous problems" and will be replaced by a polynomial
4343+ # algorithm soon, disable this test for now.
4444+ # https://github.com/sagemath/sage/issues/34575
4545+ ./patches/disable-slow-glpk-test.patch
9246 ];
93479448 # Patches needed because of package updates. We could just pin the versions of
···9852 # should come from or be proposed to upstream. This list will probably never
9953 # be empty since dependencies update all the time.
10054 packageUpgradePatches = [
101101- # After updating smypow to (https://trac.sagemath.org/ticket/3360) we can
102102- # now set the cache dir to be within the .sage directory. This is not
103103- # strictly necessary, but keeps us from littering in the user's HOME.
104104- ./patches/sympow-cache.patch
105105-106106- # Upstream will wait until Sage 9.7 to upgrade to linbox 1.7 because it
107107- # does not support gcc 6. We can upgrade earlier.
108108- # https://trac.sagemath.org/ticket/32959
109109- ./patches/linbox-1.7-upgrade.patch
110110-111111- # adapted from https://trac.sagemath.org/ticket/23712#comment:22
112112- ./patches/tachyon-renamed-focallength.patch
113113-114114- # https://trac.sagemath.org/ticket/34391
115115- (fetchSageDiff {
116116- name = "gap-4.12-upgrade.patch";
117117- base = "9.8.beta7";
118118- rev = "dd4a17281adcda74e11f998ef519b6bd0dafb043";
119119- sha256 = "sha256-UQT9DO9xd5hh5RucvUkIm+rggPKu8bc1YaSI6LVYH98=";
120120- })
121121-122122- # https://trac.sagemath.org/ticket/34701
123123- (fetchSageDiff {
124124- name = "libgap-fix-gc-crashes-on-aarch64.patch";
125125- base = "eb8cd42feb58963adba67599bf6e311e03424328"; # TODO: update when #34391 lands
126126- rev = "90acc7f1c13a80b8aa673469a2668feb9cd4207f";
127127- sha256 = "sha256-9BhQLFB3wUhiXRQsK9L+I62lSjvTfrqMNi7QUIQvH4U=";
128128- })
129129-130130- # https://github.com/sagemath/sage/pull/35235
5555+ # https://github.com/sagemath/sage/pull/35584, positively reviewed
13156 (fetchpatch {
132132- name = "ipython-8.11-upgrade.patch";
133133- url = "https://github.com/sagemath/sage/commit/23471e2d242c4de8789d7b1fc8b07a4b1d1e595a.diff";
134134- sha256 = "sha256-wvH4BvDiaBv7jbOP8LvOE5Vs16Kcwz/C9jLpEMohzLQ=";
5757+ name = "networkx-3.1-upgrade.patch";
5858+ url = "https://github.com/sagemath/sage/compare/10.0.rc2..e599562cf5fdfb9799a5412fac40c2f8e9f97341.diff";
5959+ sha256 = "sha256-3A90kXqNR0c7+k8xrZXAt5wqWg/VFAPNhQujwTdOyhI=";
13560 })
13661137137- # positively reviewed
6262+ # https://github.com/sagemath/sage/pull/35612, positively reviewed
13863 (fetchpatch {
139139- name = "matplotlib-3.7.0-upgrade.patch";
140140- url = "https://github.com/sagemath/sage/pull/35177.diff";
141141- sha256 = "sha256-YdPnMsjXBm9ZRm6a8hH8rSynkrABjLoIzqwp3F/rKAw=";
6464+ name = "linbox-1.7-upgrade.patch";
6565+ url = "https://github.com/sagemath/sage/compare/10.0.rc2..9c8796c7b677e3a056348e3510331ea8b8c3c42e.diff";
6666+ sha256 = "sha256-/TpvIQZUqmbUuz6wvp3ni9oRir5LBA2FKDJcmnHI1r4=";
14267 })
14368144144- # https://github.com/sagemath/sage/pull/35336, merged in 10.0.beta8
6969+ # https://github.com/sagemath/sage/pull/35619
14570 (fetchpatch {
146146- name = "ipywidgets-8.0.5-upgrade.patch";
147147- url = "https://github.com/sagemath/sage/commit/7ab3e3aa81d47a35d09161b965bba8ab16fd5c9e.diff";
148148- sha256 = "sha256-WjdsPTui6uv92RerlV0mqltmLaxADvz+3aqSvxBFmfU=";
7171+ name = "maxima-5.46.0-upgrade.patch";
7272+ url = "https://github.com/sagemath/sage/compare/10.0.rc3..7e86af5dae8f89868b25a6f57189bb5ca618da89.diff";
7373+ sha256 = "sha256-pxSxdJ2lyHoMUIxhlIn1nTHaddRxGvvTj9IbwFCTBFU=";
14974 })
15075151151- # https://github.com/sagemath/sage/pull/35499
7676+ # https://github.com/sagemath/sage/pull/35635, positively reviewed
15277 (fetchpatch {
153153- name = "ipywidgets-8.0.5-upgrade-part-deux.patch";
154154- url = "https://github.com/sagemath/sage/pull/35499.diff";
155155- sha256 = "sha256-uNCjLs9qrARTQNsq1+kTdvuV2A1M4xx5b1gWh5c55X0=";
7878+ name = "sympy-1.12-upgrade.patch";
7979+ url = "https://github.com/sagemath/sage/compare/10.0.rc2..aa4193cdc8ec9fb7bd7c49696b7f914668f7913a.diff";
8080+ sha256 = "sha256-UAmYCxHvnE5p+H2DySNZTPFVm915jHtOEoG+tZz5n7I=";
15681 })
157157-158158- # rebased from https://github.com/sagemath/sage/pull/34994, merged in sage 10.0.beta2
159159- ./patches/numpy-1.24-upgrade.patch
160160-161161- # Sage uses mixed integer programs (MIPs) to find edge disjoint
162162- # spanning trees. For some reason, aarch64 glpk takes much longer
163163- # than x86_64 glpk to solve such MIPs. Since the MIP formulation
164164- # has "numerous problems" and will be replaced by a polynomial
165165- # algorithm soon, disable this test for now.
166166- # https://trac.sagemath.org/ticket/34575
167167- ./patches/disable-slow-glpk-test.patch
16882 ];
1698317084 patches = nixPatches ++ bugfixPatches ++ packageUpgradePatches;
···17993 "s|var(\"SAGE_ROOT\".*|var(\"SAGE_ROOT\", \"$out\")|" \
18094 src/sage/env.py
18195182182- # src/doc/en/reference/spkg/conf.py expects index.rst in its directory,
183183- # a list of external packages in the sage distribution (build/pkgs)
184184- # generated by the bootstrap script (which we don't run). this is not
185185- # relevant for other distributions, so remove it.
186186- rm src/doc/en/reference/spkg/conf.py
187187- sed -i "/spkg/d" src/doc/en/reference/index.rst
9696+ # docbuilding expects a spkg index generated by the doc/bootstrap script (which
9797+ # we don't run) to exist. the spkg list includes nix package names, but it's not
9898+ # worth the hassle of running the bootstrap script, so just create a dummy index.
9999+ touch src/doc/en/reference/spkg/index.rst
188100189101 # the bootstrap script also generates installation instructions for
190102 # arch, debian, fedora, cygwin and homebrew using data from build/pkgs.