Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkgs/applications/science/math/sage/env-locations.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ writeTextFile rec {
export GPDOCDIR="${pari}/share/pari/doc"
export SINGULARPATH='${singular}/share/singular'
export SINGULAR_SO='${singular}/lib/libSingular.so'
export GAP_SO='${gap}/lib/libgap.so'
export SINGULAR_EXECUTABLE='${singular}/bin/Singular'
export MAXIMA_FAS='${maxima-ecl}/lib/maxima/${maxima-ecl.version}/binary-ecl/maxima.fas'
export MAXIMA_PREFIX="${maxima-ecl}"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
diff --git a/src/sage/env.py b/src/sage/env.py
index 061b94f3f1..67cd091540 100644
--- a/src/sage/env.py
+++ b/src/sage/env.py
@@ -189,88 +189,13 @@ var('MAXIMA_FAS')
var('SAGE_BANNER', '')
var('SAGE_IMPORTALL', 'yes')

-
-def _get_shared_lib_filename(libname, *additional_libnames):
- """
- Return the full path to a shared library file installed in the standard
- location for the system within the ``LIBDIR`` prefix (or
- ``$SAGE_LOCAL/lib`` in the case of manual build of Sage).
-
- This can also be passed more than one library name (e.g. for cases where
- some library may have multiple names depending on the platform) in which
- case the first one found is returned.
-
- This supports most *NIX variants (in which ``lib<libname>.so`` is found
- under ``$SAGE_LOCAL/lib``), macOS (same, but with the ``.dylib``
- extension), and Cygwin (under ``$SAGE_LOCAL/bin/cyg<libname>.dll``,
- or ``$SAGE_LOCAL/bin/cyg<libname>-*.dll`` for versioned DLLs).
-
- For distributions like Debian that use a multiarch layout, we also try the
- multiarch lib paths (i.e. ``/usr/lib/<arch>/``).
-
- Returns ``None`` if the file does not exist.
-
- EXAMPLES::
-
- sage: import sys
- sage: from fnmatch import fnmatch
- sage: from sage.env import _get_shared_lib_filename
- sage: lib_filename = _get_shared_lib_filename("Singular",
- ....: "singular-Singular")
- sage: if sys.platform == 'cygwin':
- ....: pattern = "*/cygSingular-*.dll"
- ....: elif sys.platform == 'darwin':
- ....: pattern = "*/libSingular.dylib"
- ....: else:
- ....: pattern = "*/lib*Singular.so"
- sage: fnmatch(lib_filename, pattern)
- True
- sage: _get_shared_lib_filename("an_absurd_lib") is None
- True
- """
-
- for libname in (libname,) + additional_libnames:
- if sys.platform == 'cygwin':
- bindir = sysconfig.get_config_var('BINDIR')
- pats = ['cyg{}.dll'.format(libname), 'cyg{}-*.dll'.format(libname)]
- filenames = []
- for pat in pats:
- filenames += glob.glob(os.path.join(bindir, pat))
-
- # Note: This is not very robust, since if there are multi DLL
- # versions for the same library this just selects one more or less
- # at arbitrary. However, practically speaking, on Cygwin, there
- # will only ever be one version
- if filenames:
- return filenames[-1]
- else:
- if sys.platform == 'darwin':
- ext = 'dylib'
- else:
- ext = 'so'
-
- libdirs = [sysconfig.get_config_var('LIBDIR')]
- multilib = sysconfig.get_config_var('MULTILIB')
- if multilib:
- libdirs.insert(0, os.path.join(libdirs[0], multilib))
-
- for libdir in libdirs:
- basename = 'lib{}.{}'.format(libname, ext)
- filename = os.path.join(libdir, basename)
- if os.path.exists(filename):
- return filename
-
- # Just return None if no files were found
- return None
-
-
# locate singular shared object
# On Debian it's libsingular-Singular so try that as well
-SINGULAR_SO = _get_shared_lib_filename('Singular', 'singular-Singular')
+SINGULAR_SO = '/default'
var('SINGULAR_SO', SINGULAR_SO)

# locate libgap shared object
-GAP_SO= _get_shared_lib_filename('gap','')
+GAP_SO= '/default'
var('GAP_SO', GAP_SO)

# post process
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/src/sage/misc/package.py b/src/sage/misc/package.py
index 3bca15d53b..7cf04ff8d1 100644
--- a/src/sage/misc/package.py
+++ b/src/sage/misc/package.py
@@ -478,16 +478,16 @@ def package_manifest(package):

EXAMPLES::

- sage: from sage.misc.package import package_manifest
- sage: sagetex_manifest = package_manifest('sagetex')
- sage: sagetex_manifest['package_name'] == 'sagetex'
+ sage: from sage.misc.package import package_manifest # optional - buildsystem
+ sage: sagetex_manifest = package_manifest('sagetex') # optional - buildsystem
+ sage: sagetex_manifest['package_name'] == 'sagetex' # optional - buildsystem
True
- sage: 'files' in sagetex_manifest
+ sage: 'files' in sagetex_manifest # optional - buildsystem
True

Test a nonexistent package::

- sage: package_manifest('dummy-package')
+ sage: package_manifest('dummy-package') # optional - buildsystem
Traceback (most recent call last):
...
KeyError: 'dummy-package'
14 changes: 0 additions & 14 deletions pkgs/applications/science/math/sage/patches/giac-1.5.0.patch

This file was deleted.

This file was deleted.

This file was deleted.

89 changes: 29 additions & 60 deletions pkgs/applications/science/math/sage/sage-src.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
# all get the same sources with the same patches applied.

stdenv.mkDerivation rec {
version = "8.6";
name = "sage-src-${version}";
version = "8.7";
pname = "sage-src";

src = fetchFromGitHub {
owner = "sagemath";
repo = "sage";
rev = version;
sha256 = "1vs3pbgbqpg0qnwr018bqsdmm7crgjp310cx8zwh7za3mv1cw5j3";
sha256 = "05vvrd6syh0hlmrk6kzjrwd0hpmvxp8vr8p3mkjb0jh5p2kjdd27";
};

# Patches needed because of particularities of nix or the way this is packaged.
Expand All @@ -37,12 +37,6 @@ stdenv.mkDerivation rec {
# https://github.com/python/cpython/pull/7476
./patches/python-5755-hotpatch.patch

# Revert the commit that made the sphinx build fork even in the single thread
# case. For some yet unknown reason, that breaks the docbuild on nix and archlinux.
# See https://groups.google.com/forum/#!msg/sage-packaging/VU4h8IWGFLA/mrmCMocYBwAJ.
# https://trac.sagemath.org/ticket/26608
./patches/revert-sphinx-always-fork.patch

# Make sure py2/py3 tests are only run when their expected context (all "sage"
# tests) are also run. That is necessary to test dochtml individually. See
# https://trac.sagemath.org/ticket/26110 for an upstream discussion.
Expand All @@ -59,6 +53,21 @@ stdenv.mkDerivation rec {
sha256 = "07p9i0fwjgapmfvmi436yn6v60p8pvmxqjc93wsssqgh5kd8qw3n";
stripLen = 1;
})

# Part of the build system. Should become unnecessary with sage 8.8.
# Upstream discussion here: https://trac.sagemath.org/ticket/27124#comment:33
./patches/do-not-test-package-manifests.patch

# Not necessary since library location is set explicitly
# https://trac.sagemath.org/ticket/27660#ticket
./patches/do-not-test-find-library.patch

# https://trac.sagemath.org/ticket/27697#ticket
(fetchpatch {
name = "pplpy-doc-location-configurable.patch";
url = "https://git.sagemath.org/sage.git/patch/?h=c4d966e7cb0c7b87c55d52dc6f46518433a2a0a2";
sha256 = "0pqbbsx8mriwny422s9mp3z5d095cnam32sm62q4mxk8g8jb9vm9";
})
];

# Since sage unfortunately does not release bugfix releases, packagers must
Expand All @@ -72,12 +81,6 @@ stdenv.mkDerivation rec {
url = "https://git.sagemath.org/sage.git/patch?id2=10407524b18659e14e184114b61c043fb816f3c2&id=c9b0cc9d0b8748ab85e568f8f57f316c5e8cbe54";
sha256 = "0wgp7yvn9sm1ynlhcr4l0hzmvr2n28llg4xc01p6k1zz4im64c17";
})
# https://trac.sagemath.org/ticket/27224
(fetchpatch {
name = "sig_on_in_matrix_misc.patch";
url = "https://git.sagemath.org/sage.git/patch?id=85d25bf2eb73f7d3c6de4ee6222b0c399be43b07";
sha256 = "1ciwhh57pnb9b4i8m3vb07wfsibsay5sg0jp5giq1pzc5zc79a4p";
})
];

# Patches needed because of package updates. We could just pin the versions of
Expand Down Expand Up @@ -110,52 +113,12 @@ stdenv.mkDerivation rec {
stripLen = 1;
})

# https://trac.sagemath.org/ticket/26315
./patches/giac-1.5.0.patch

# https://trac.sagemath.org/ticket/26442
(fetchSageDiff {
name = "cypari2-2.0.3.patch";
base = "8.6.rc1";
rev = "cd62d45bcef93fb4f7ed62609a46135e6de07051";
sha256 = "08l2b9w0rn1zrha6188j72f7737xs126gkgmydjd31baa6367np2";
})

# https://trac.sagemath.org/ticket/26949
(fetchpatch {
name = "sphinx-1.8.3-dependency.patch";
url = "https://git.sagemath.org/sage.git/patch?id=d305eda0fedc73fdbe0447b5d6d2b520b8d112c4";
sha256 = "1x3q5j8lq35vlj893gj5gq9fhzs60szm9r9rx6ri79yiy9apabph";
})
# https://trac.sagemath.org/ticket/26451
(fetchpatch {
name = "sphinx-1.8.3.patch";
url = "https://git.sagemath.org/sage.git/patch?id2=0cb494282d7b4cea50aba7f4d100e7932a4c00b1&id=62b989d5ee1d9646db85ea56053cd22e9ffde5ab";
sha256 = "1n5c61mvhalcr2wbp66wzsynwwk59aakvx3xqa5zw9nlkx3rd0h1";
})

# https://trac.sagemath.org/ticket/27061
(fetchpatch {
name = "numpy-1.16-inline-fortran.patch";
url = "https://git.sagemath.org/sage.git/patch?id=a05b6b038e1571ab15464e98f76d1927c0c3fd12";
sha256 = "05yq97pq84xi60wb1p9skrad5h5x770gq98ll4frr7hvvmlwsf58";
})

# https://trac.sagemath.org/ticket/27405
./patches/ignore-pip-deprecation.patch

# https://trac.sagemath.org/ticket/27360
(fetchpatch {
name = "eclib-20190226.patch";
url = "https://git.sagemath.org/sage.git/patch/?id=f570e3a7fc2965764b84c04ce301a88ded2c42df";
sha256 = "0l5c4giixkn15v2a06sfzq5mkxila6l67zkjbacirwprrlpcnmmp";
})

# https://trac.sagemath.org/ticket/27420
(fetchpatch {
name = "cypari-2.1.patch";
url = "https://git.sagemath.org/sage.git/patch/?id=e351bf2f2914e683d5e2028597c45ae8d1b7f855";
sha256 = "00faa7fl0vaqcqbw0bidkhl78qa8l34d3a07zirbcl0vm74bdn1p";
(fetchSageDiff {
name = "sphinx-1.8.patch";
base = "8.7";
rev = "737afd8f314bd1e16feaec562bb4b5efa2effa8b";
sha256 = "0n56ss88ds662bp49j23z5c2i6hsn3jynxw13wv76hyl0h7l1hjh";
})

# https://trac.sagemath.org/ticket/27653
Expand All @@ -177,6 +140,12 @@ stdenv.mkDerivation rec {
echo '#!${runtimeShell}
python "$@"' > build/bin/sage-python23

# Make sure sage can at least be imported without setting any environment
# variables. It won't be close to feature complete though.
sed -i \
"s|var('SAGE_LOCAL',.*|var('SAGE_LOCAL', '$out/src')|" \
src/sage/env.py

# Do not use sage-env-config (generated by ./configure).
# Instead variables are set manually.
echo '# do nothing' > src/bin/sage-env-config
Expand Down
3 changes: 3 additions & 0 deletions pkgs/applications/science/math/sage/sagedoc.nix
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ stdenv.mkDerivation rec {
export HOME="$TMPDIR/sage_home"
mkdir -p "$HOME"

# needed to link them in the sage docs using intersphinx
export PPLPY_DOCS=${python.pkgs.pplpy.doc}/share/doc/pplpy

${sage-with-env}/bin/sage -python -m sage_setup.docbuild \
--mathjax \
--no-pdf-links \
Expand Down
Loading