Skip to content

Commit 5e3c4ec

Browse files
antonio-rojasdimpase
authored andcommitted
Search for files in both lib/gap and share/gap
`make install` installs files in both paths
1 parent bde3df7 commit 5e3c4ec

File tree

3 files changed

+5
-31
lines changed

3 files changed

+5
-31
lines changed

src/sage/env.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@ def var(key: str, *fallbacks: Optional[str], force: bool = False) -> Optional[st
198198
GRAPHS_DATA_DIR = var("GRAPHS_DATA_DIR", join(SAGE_SHARE, "graphs"))
199199
ELLCURVE_DATA_DIR = var("ELLCURVE_DATA_DIR", join(SAGE_SHARE, "ellcurves"))
200200
POLYTOPE_DATA_DIR = var("POLYTOPE_DATA_DIR", join(SAGE_SHARE, "reflexive_polytopes"))
201-
GAP_ROOT_DIR = var("GAP_ROOT_DIR", join(SAGE_SHARE, "gap"))
201+
GAP_LIB_DIR = var("GAP_LIB_DIR", join(SAGE_LOCAL, "lib", "gap"))
202+
GAP_SHARE_DIR = var("GAP_SHARE_DIR", join(SAGE_SHARE, "gap"))
202203
THEBE_DIR = var("THEBE_DIR", join(SAGE_SHARE, "thebe"))
203204
COMBINATORIAL_DESIGN_DATA_DIR = var("COMBINATORIAL_DESIGN_DATA_DIR", join(SAGE_SHARE, "combinatorial_designs"))
204205
CREMONA_MINI_DATA_DIR = var("CREMONA_MINI_DATA_DIR", join(SAGE_SHARE, "cremona"))

src/sage/libs/gap/saved_workspace.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import os
1010
import glob
11-
from sage.env import GAP_ROOT_DIR
11+
from sage.env import GAP_LIB_DIR
1212
from sage.interfaces.gap_workspace import gap_workspace_file
1313

1414

@@ -31,7 +31,7 @@ def timestamp():
3131
"""
3232
libgap_dir = os.path.dirname(__file__)
3333
libgap_files = glob.glob(os.path.join(libgap_dir, '*'))
34-
gap_packages = glob.glob(os.path.join(GAP_ROOT_DIR, 'pkg', '*'))
34+
gap_packages = glob.glob(os.path.join(GAP_LIB_DIR, 'pkg', '*'))
3535
files = libgap_files + gap_packages
3636
if len(files) == 0:
3737
print('Unable to find LibGAP files.')

src/sage/libs/gap/util.pyx

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -164,33 +164,6 @@ cdef void gasman_callback() with gil:
164164
### Initialization of GAP ##################################################
165165
############################################################################
166166

167-
def gap_root():
168-
"""
169-
Find the location of the GAP root install which is stored in the gap
170-
startup script.
171-
172-
EXAMPLES::
173-
174-
sage: from sage.libs.gap.util import gap_root
175-
sage: gap_root() # random output
176-
'/home/vbraun/opt/sage-5.3.rc0/local/gap/latest'
177-
"""
178-
if os.path.exists(sage.env.GAP_ROOT_DIR):
179-
return sage.env.GAP_ROOT_DIR
180-
181-
# Attempt to figure out the appropriate GAP_ROOT by reading the
182-
# local/bin/gap shell script; this is an ugly hack that exists for
183-
# historical reasons; the best approach to setting where Sage looks for
184-
# the appropriate GAP_ROOT is to set the GAP_ROOT_DIR variable
185-
SAGE_LOCAL = sage.env.SAGE_LOCAL
186-
with open(os.path.join(SAGE_LOCAL, 'bin', 'gap')) as f:
187-
gap_sh = f.read().splitlines()
188-
gapdir = next(x for x in gap_sh if x.strip().startswith('GAP_ROOT'))
189-
gapdir = gapdir.split('"')[1]
190-
gapdir = gapdir.replace('$SAGE_LOCAL', SAGE_LOCAL)
191-
return gapdir
192-
193-
194167
# To ensure that we call initialize_libgap only once.
195168
cdef bint _gap_is_initialized = False
196169

@@ -245,7 +218,7 @@ cdef initialize():
245218
cdef char* argv[16]
246219
argv[0] = "sage"
247220
argv[1] = "-l"
248-
s = str_to_bytes(gap_root(), FS_ENCODING, "surrogateescape")
221+
s = str_to_bytes(sage.env.GAP_LIB_DIR + ";" + sage.env.GAP_SHARE_DIR, FS_ENCODING, "surrogateescape")
249222
argv[2] = s
250223

251224
argv[3] = "-m"

0 commit comments

Comments
 (0)