about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/science/math/sage/patches/do-not-test-find-library.patch
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/science/math/sage/patches/do-not-test-find-library.patch')
-rw-r--r--nixpkgs/pkgs/applications/science/math/sage/patches/do-not-test-find-library.patch95
1 files changed, 95 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/science/math/sage/patches/do-not-test-find-library.patch b/nixpkgs/pkgs/applications/science/math/sage/patches/do-not-test-find-library.patch
new file mode 100644
index 000000000000..3f844e1b1ef5
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/math/sage/patches/do-not-test-find-library.patch
@@ -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