From 26a87ada65c74ecab36789aaf5915f55148e1100 Mon Sep 17 00:00:00 2001 From: Mauricio Collares Date: Fri, 18 Mar 2022 23:16:18 -0300 Subject: [PATCH] sage: 9.5 -> 9.6 --- ...xternal-software-when-all-of-sage-is.patch | 46 ---------- .../configurationpy-error-verbose.patch | 2 +- .../patches/docutils-0.18.1-deprecation.patch | 4 +- .../sphinx-docbuild-subprocesses.patch | 17 ++-- .../science/math/sage/sage-env.nix | 2 +- .../science/math/sage/sage-src.nix | 89 ++----------------- .../science/math/sage/sagedoc.nix | 6 +- .../science/math/sage/sagelib.nix | 8 +- 8 files changed, 30 insertions(+), 144 deletions(-) delete mode 100644 pkgs/applications/science/math/sage/patches/Only-test-external-software-when-all-of-sage-is.patch diff --git a/pkgs/applications/science/math/sage/patches/Only-test-external-software-when-all-of-sage-is.patch b/pkgs/applications/science/math/sage/patches/Only-test-external-software-when-all-of-sage-is.patch deleted file mode 100644 index a478f50d92e8..000000000000 --- a/pkgs/applications/science/math/sage/patches/Only-test-external-software-when-all-of-sage-is.patch +++ /dev/null @@ -1,46 +0,0 @@ -diff --git a/src/sage/doctest/control.py b/src/sage/doctest/control.py -index 01f32fb8e4..4d83dc7b47 100644 ---- a/src/sage/doctest/control.py -+++ b/src/sage/doctest/control.py -@@ -1253,6 +1253,7 @@ class DocTestController(SageObject): - - self.log("Using --optional=" + self._optional_tags_string()) - available_software._allow_external = self.options.optional is True or 'external' in self.options.optional -+ available_software._autodetect_safe = self.options.optional is True or 'sage' in self.options.optional - self.log("Features to be detected: " + ','.join(available_software.detectable())) - self.add_files() - self.expand_files_into_sources() -diff --git a/src/sage/doctest/external.py b/src/sage/doctest/external.py -index 84dae19ea5..badc61466e 100644 ---- a/src/sage/doctest/external.py -+++ b/src/sage/doctest/external.py -@@ -409,6 +409,7 @@ class AvailableSoftware(object): - [] - """ - self._allow_external = True -+ self._autodetect_safe = True - # For multiprocessing of doctests, the data self._seen should be - # shared among subprocesses. Thus we use Array class from the - # multiprocessing module. -@@ -430,6 +431,8 @@ class AvailableSoftware(object): - sage: 'internet' in available_software # random, optional - internet - True - """ -+ if not self._autodetect_safe: -+ return False - try: - idx = self._indices[item] - except KeyError: -diff --git a/src/sage/features/sagemath.py b/src/sage/features/sagemath.py -index 433338766d..233623b14a 100644 ---- a/src/sage/features/sagemath.py -+++ b/src/sage/features/sagemath.py -@@ -12,7 +12,7 @@ class sagemath_doc_html(StaticFile): - - EXAMPLES:: - -- sage: from sage.features.sagemath import sagemath_doc_html -+ sage: from sage.features.sagemath import sagemath_doc_html # optional - sagemath_doc_html - sage: sagemath_doc_html().is_present() # optional - sagemath_doc_html - FeatureTestResult('sagemath_doc_html', True) - """ diff --git a/pkgs/applications/science/math/sage/patches/configurationpy-error-verbose.patch b/pkgs/applications/science/math/sage/patches/configurationpy-error-verbose.patch index e687281ad1a7..ca01eba29a2b 100644 --- a/pkgs/applications/science/math/sage/patches/configurationpy-error-verbose.patch +++ b/pkgs/applications/science/math/sage/patches/configurationpy-error-verbose.patch @@ -13,7 +13,7 @@ index 67d7d2accf..18279581e2 100644 - True + sage: print(output) + sage...[False, True] -+ sage...Exiting Sage ... ++ ... """ #***************************************************************************** diff --git a/pkgs/applications/science/math/sage/patches/docutils-0.18.1-deprecation.patch b/pkgs/applications/science/math/sage/patches/docutils-0.18.1-deprecation.patch index 94e0488e21e7..0a19e7af1048 100644 --- a/pkgs/applications/science/math/sage/patches/docutils-0.18.1-deprecation.patch +++ b/pkgs/applications/science/math/sage/patches/docutils-0.18.1-deprecation.patch @@ -1,11 +1,11 @@ diff --git a/src/sage/misc/sagedoc.py b/src/sage/misc/sagedoc.py -index 4c56aea078..e51a77ae8a 100644 +index 08c4225b87..3a9bbe4ed0 100644 --- a/src/sage/misc/sagedoc.py +++ b/src/sage/misc/sagedoc.py @@ -1402,6 +1402,8 @@ class _sage_doc: sage: identity_matrix.__doc__ in browse_sage_doc(identity_matrix, 'rst') True - sage: browse_sage_doc(identity_matrix, 'html', False) # optional - sphinx + sage: browse_sage_doc(identity_matrix, 'html', False) # optional - sphinx sagemath_doc_html + ... + FutureWarning: The configuration setting "embed_images" will be removed in Docutils 1.2. Use "image_loading: link". '...div...File:...Type:...Definition:...identity_matrix...' diff --git a/pkgs/applications/science/math/sage/patches/sphinx-docbuild-subprocesses.patch b/pkgs/applications/science/math/sage/patches/sphinx-docbuild-subprocesses.patch index 1ff081b25e0f..3e7e37508ff4 100644 --- a/pkgs/applications/science/math/sage/patches/sphinx-docbuild-subprocesses.patch +++ b/pkgs/applications/science/math/sage/patches/sphinx-docbuild-subprocesses.patch @@ -1,10 +1,10 @@ diff --git a/src/sage_docbuild/__init__.py b/src/sage_docbuild/__init__.py -index 8a5c1a19d2..21fd192642 100644 +index b12d56a3c9..df9d949ed1 100644 --- a/src/sage_docbuild/__init__.py +++ b/src/sage_docbuild/__init__.py -@@ -89,27 +89,6 @@ def builder_helper(type): +@@ -88,30 +88,6 @@ def builder_helper(type): """ - Returns a function which builds the documentation for + Return a function which builds the documentation for output type ``type``. - - TESTS: @@ -19,10 +19,13 @@ index 8a5c1a19d2..21fd192642 100644 - ....: raise BaseException("abort pool operation") - sage: original_runsphinx, sage_docbuild.sphinxbuild.runsphinx = sage_docbuild.sphinxbuild.runsphinx, raiseBaseException - +- sage: from sage.misc.temporary_file import tmp_dir +- sage: os.environ['SAGE_DOC'] = tmp_dir() +- sage: sage.env.var('SAGE_DOC') # random - sage: from sage_docbuild import builder_helper, build_ref_doc - sage: from sage_docbuild import _build_many as build_many - sage: helper = builder_helper("html") -- sage: try: +- sage: try: # optional - sagemath_doc_html - ....: build_many(build_ref_doc, [("docname", "en", "html", {})]) - ....: except Exception as E: - ....: "Non-exception during docbuild: abort pool operation" in str(E) @@ -30,7 +33,7 @@ index 8a5c1a19d2..21fd192642 100644 """ def f(self, *args, **kwds): output_dir = self._output_dir(type) -@@ -131,10 +110,9 @@ def builder_helper(type): +@@ -139,10 +115,9 @@ def builder_helper(type): logger.debug(build_command) # Run Sphinx with Sage's special logger @@ -44,10 +47,10 @@ index 8a5c1a19d2..21fd192642 100644 if ABORT_ON_ERROR: raise diff --git a/src/sage_docbuild/sphinxbuild.py b/src/sage_docbuild/sphinxbuild.py -index d917c3e9d4..551cc8028a 100644 +index a39c99ffe9..73be823684 100644 --- a/src/sage_docbuild/sphinxbuild.py +++ b/src/sage_docbuild/sphinxbuild.py -@@ -327,3 +327,8 @@ def runsphinx(): +@@ -330,3 +330,8 @@ def runsphinx(): sys.stderr = saved_stderr sys.stdout.flush() sys.stderr.flush() diff --git a/pkgs/applications/science/math/sage/sage-env.nix b/pkgs/applications/science/math/sage/sage-env.nix index cdff1e8477ab..4c22470de910 100644 --- a/pkgs/applications/science/math/sage/sage-env.nix +++ b/pkgs/applications/science/math/sage/sage-env.nix @@ -186,7 +186,7 @@ writeTextFile rec { export SAGE_EXTCODE='${sagelib.src}/src/sage/ext_data' # for find_library - export DYLD_LIBRARY_PATH="${lib.makeLibraryPath [stdenv.cc.libc singular]}''${DYLD_LIBRARY_PATH:+:}$DYLD_LIBRARY_PATH" + export DYLD_LIBRARY_PATH="${lib.makeLibraryPath [stdenv.cc.libc singular giac]}''${DYLD_LIBRARY_PATH:+:}$DYLD_LIBRARY_PATH" ''; } // { # equivalent of `passthru`, which `writeTextFile` doesn't support lib = sagelib; diff --git a/pkgs/applications/science/math/sage/sage-src.nix b/pkgs/applications/science/math/sage/sage-src.nix index b230b0d42a03..95da9b26e54e 100644 --- a/pkgs/applications/science/math/sage/sage-src.nix +++ b/pkgs/applications/science/math/sage/sage-src.nix @@ -58,30 +58,19 @@ let ); in stdenv.mkDerivation rec { - version = "9.5"; + version = "9.6"; pname = "sage-src"; src = fetchFromGitHub { owner = "sagemath"; repo = "sage"; rev = version; - sha256 = "sha256-uOsLpsGpcIGs8Xr82X82MElnTB2E908gytyNJ8WVD5w="; + sha256 = "sha256-QY8Yga3hD1WhSCtA2/PVry8hHlMmC31J8jCBFtWgIU0="; }; # 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 = [ - # Since https://trac.sagemath.org/ticket/32174, some external features are - # marked as "safe" and get auto-detected, in which case the corresponding - # optional tests are executed. We disable auto-detection of safe features if - # we are doctesting with an "--optional" argument which does not include - # "sage", because tests from autodetected features expect context provided - # by running basic sage tests. This is necessary to test sagemath_doc_html - # separately. See https://trac.sagemath.org/ticket/26110 for a related - # upstream discussion (from the time when Sage still had optional py2/py3 - # tags). - ./patches/Only-test-external-software-when-all-of-sage-is.patch - # Fixes a potential race condition which can lead to transient doctest failures. ./patches/fix-ecl-race.patch @@ -120,81 +109,13 @@ stdenv.mkDerivation rec { # https://trac.sagemath.org/ticket/32959 ./patches/linbox-1.7-upgrade.patch - # https://trac.sagemath.org/ticket/33170 - (fetchSageDiff { - base = "9.6.beta5"; - name = "ipython-8.1-update.patch"; - rev = "4d2b53f1541375861310af3a7f7109c1c2ed475d"; - sha256 = "sha256-ELda/VBzsQH7NdFas69fQ35QPUoJCeLx/gxT1j7qGR8="; - }) - - # https://trac.sagemath.org/ticket/32968 - (fetchSageDiff { - base = "9.5"; - name = "sphinx-4.3-update.patch"; - rev = "fc84f82f52b6f05f512cb359ec7c100f93cf8841"; - sha256 = "sha256-bBbfdcnw/9LUOlY8rHJRbFJEdMXK4shosqTNaobTS1Q="; - }) - - # https://trac.sagemath.org/ticket/33189 - (fetchSageDiff { - base = "9.5"; - name = "arb-2.22-update.patch"; - rev = "53532ddd4e2dc92469c1590ebf0c40f8f69bf579"; - sha256 = "sha256-6SoSBvIlqvNwZV3jTB6uPdUtaWIOeNmddi2poK/WvGs="; - }) - - # TODO: This will not be necessary when Sphinx 4.4.1 is released, - # since some warnings introduced in 4.4.0 will be disabled by then - # (https://github.com/sphinx-doc/sphinx/pull/10126). - # https://trac.sagemath.org/ticket/33272 - (fetchSageDiff { - base = "9.5"; - name = "sphinx-4.4-warnings.patch"; - rev = "97d7958bed441cf2ccc714d88f83d3a8426bc085"; - sha256 = "sha256-y1STE0oxswnijGCsBw8eHWWqpmT1XMznIfA0vvX9pFA="; - }) - # adapted from https://trac.sagemath.org/ticket/23712#comment:22 ./patches/tachyon-renamed-focallength.patch - # https://trac.sagemath.org/ticket/33336 - (fetchSageDiff { - base = "9.6.beta2"; - name = "scipy-1.8-update.patch"; - rev = "9c8235e44ffb509efa8a3ca6cdb55154e2b5066d"; - sha256 = "sha256-bfc4ljNOxVnhlmxIuNbjbKl4vJXYq2tlF3Z8bbC8PWw="; - }) - - # https://trac.sagemath.org/ticket/33495 - (fetchSageDiff { - base = "9.6.beta5"; - name = "networkx-2.7-update.patch"; - rev = "8452003846a7303100847d8d0ed642fc642c11d6"; - sha256 = "sha256-A/XMouPlc2sjFp30L+56fBGJXydS2EtzfPOV98FCDqI="; - }) - - # https://trac.sagemath.org/ticket/33226 - (fetchSageDiff { - base = "9.6.beta0"; - name = "giac-1.7.0-45-update.patch"; - rev = "33ea2adf01e9e2ce9f1e33779f0b1ac0d9d1989c"; - sha256 = "sha256-DOyxahf3+IaYdkgmAReNDCorRzMgO8+yiVrJ5TW1km0="; - }) - - # https://trac.sagemath.org/ticket/33398 - (fetchSageDiff { - base = "9.6.beta4"; - name = "sympy-1.10-update.patch"; - rev = "6b7c3a28656180e42163dc10f7b4a571b93e5f27"; - sha256 = "sha256-fnUyM2yjHkCykKRfzQQ4glcUYmCS/fYzDzmCf0nuebk="; - # The patch contains a whitespace change to a file that didn't exist in Sage 9.5. - excludes = [ "build/*" "src/sage/manifolds/vector_bundle_fiber_element.py" ]; - }) - # docutils 0.18.1 now triggers Sphinx warnings. tolerate them for - # now, because patching Sphinx is not feasible. - # https://github.com/sphinx-doc/sphinx/issues/9777#issuecomment-1104481271 + # now, because patching Sphinx is not feasible. remove when Sphinx + # 5.0 hits nixpkgs. + # https://github.com/sphinx-doc/sphinx/pull/10372 ./patches/docutils-0.18.1-deprecation.patch ]; diff --git a/pkgs/applications/science/math/sage/sagedoc.nix b/pkgs/applications/science/math/sage/sagedoc.nix index 55674719064e..67d754caff3c 100644 --- a/pkgs/applications/science/math/sage/sagedoc.nix +++ b/pkgs/applications/science/math/sage/sagedoc.nix @@ -89,6 +89,10 @@ stdenv.mkDerivation rec { doCheck = true; checkPhase = '' - ${sage-with-env}/bin/sage -t --optional=sagemath_doc_html --all + # sagemath_doc_html tests assume sage tests are being run, so we + # compromise: we run standard tests, but only on files containing + # relevant tests. as of Sage 9.6, there are only 4 such files. + grep -PRl "#.*optional.*sagemath_doc_html" ${src}/src/sage{,_docbuild} | \ + xargs ${sage-with-env}/bin/sage -t --optional=sage,sagemath_doc_html ''; } diff --git a/pkgs/applications/science/math/sage/sagelib.nix b/pkgs/applications/science/math/sage/sagelib.nix index 92eae35688f7..8f864d136928 100644 --- a/pkgs/applications/science/math/sage/sagelib.nix +++ b/pkgs/applications/science/math/sage/sagelib.nix @@ -67,7 +67,9 @@ , pillow , ipykernel , networkx -, sphinx # TODO: this is in setup.cfg, bug should we override it? +, ptyprocess +, lrcalc-python +, sphinx # TODO: this is in setup.cfg, should we override it? }: assert (!blas.isILP64) && (!lapack.isILP64); @@ -157,6 +159,8 @@ buildPythonPackage rec { networkx jupyter-client ipywidgets + ptyprocess + lrcalc-python sphinx ]; @@ -188,7 +192,7 @@ buildPythonPackage rec { # Sage tests already catch any relevant API breakage. # according to the discussion at https://trac.sagemath.org/ticket/33520, # upper bounds will be less noisy starting from Sage 9.6. - sed -i 's/==2.1.0rc1/>=2.1.1/' ../gmpy2/install-requires.txt + sed -i 's/==0.5.1/>=0.5.1/' ../ptyprocess/install-requires.txt sed -i 's/, <[^, ]*//' ../*/install-requires.txt for infile in src/*.m4; do