about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/science/math/sage/patches/do-not-test-find-library.patch
blob: 0dbfba642e82ad2e8e1a991c89da79b4b3d25feb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
diff --git a/src/sage/env.py b/src/sage/env.py
index 2908f5d04f..81dfd75c0d 100644
--- a/src/sage/env.py
+++ b/src/sage/env.py
@@ -218,93 +218,12 @@ NTL_LIBDIR = var("NTL_LIBDIR")
 SAGE_BANNER = var("SAGE_BANNER", "")
 SAGE_IMPORTALL = var("SAGE_IMPORTALL", "yes")
 
-
-def _get_shared_lib_path(*libnames: str) -> Optional[str]:
-    """
-    Return the full path to a shared library file installed in
-    ``$SAGE_LOCAL/lib`` or the directories associated with the
-    Python sysconfig.
-
-    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>/``).
-
-    This returns ``None`` if no matching library file could be found.
-
-    EXAMPLES::
-
-        sage: import sys
-        sage: from fnmatch import fnmatch
-        sage: from sage.env import _get_shared_lib_path
-        sage: lib_filename = _get_shared_lib_path("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(str(lib_filename), pattern)
-        True
-        sage: _get_shared_lib_path("an_absurd_lib") is None
-        True
-    """
-
-    for libname in libnames:
-        search_directories: List[Path] = []
-        patterns: List[str] = []
-        if sys.platform == 'cygwin':
-            # Later down we take the first matching DLL found, so search
-            # SAGE_LOCAL first so that it takes precedence
-            search_directories = [
-                Path(SAGE_LOCAL) / 'bin',
-                Path(sysconfig.get_config_var('BINDIR')),
-            ]
-            # Note: The following is not very robust, since if there are multible
-            # 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
-            patterns = [f'cyg{libname}.dll', f'cyg{libname}-*.dll']
-        else:
-            if sys.platform == 'darwin':
-                ext = 'dylib'
-            else:
-                ext = 'so'
-
-            search_directories = [Path(SAGE_LOCAL) / 'lib']
-            libdir = sysconfig.get_config_var('LIBDIR')
-            if libdir is not None:
-                libdir = Path(libdir)
-                search_directories.append(libdir)
-
-                multiarchlib = sysconfig.get_config_var('MULTIARCH')
-                if multiarchlib is not None: 
-                    search_directories.append(libdir / multiarchlib),
-
-            patterns = [f'lib{libname}.{ext}']
-
-        for directory in search_directories:
-            for pattern in patterns:
-                path = next(directory.glob(pattern), None)
-                if path is not None:
-                    return str(path.resolve())
-
-    # 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 = var("SINGULAR_SO", _get_shared_lib_path("Singular", "singular-Singular"))
+SINGULAR_SO = var("SINGULAR_SO", '/default')
 
 # locate libgap shared object
-GAP_SO = var("GAP_SO", _get_shared_lib_path("gap", ""))
+GAP_SO = var("GAP_SO", '/default')
 
 # post process
 if ' ' in DOT_SAGE: