Skip to content

Commit ac4b671

Browse files
tornariadimpase
authored andcommitted
gap_workspace_file: use GAP_LIB_DIR and GAP_SHARE_DIR
1 parent e115716 commit ac4b671

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/sage/interfaces/gap_workspace.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import time
1818
import hashlib
1919
import subprocess
20-
from sage.env import DOT_SAGE, SAGE_LOCAL, HOSTNAME, GAP_ROOT_DIR
20+
from sage.env import DOT_SAGE, HOSTNAME, GAP_LIB_DIR, GAP_SHARE_DIR
2121

2222

2323
def gap_workspace_file(system="gap", name="workspace", dir=None):
@@ -60,12 +60,13 @@ def gap_workspace_file(system="gap", name="workspace", dir=None):
6060
if dir is None:
6161
dir = os.path.join(DOT_SAGE, 'gap')
6262

63-
data = SAGE_LOCAL
64-
sysinfo = os.path.join(GAP_ROOT_DIR, "sysinfo.gap")
65-
if os.path.exists(sysinfo):
66-
data += subprocess.getoutput(f'. "{sysinfo}" && echo ":$GAP_VERSION:$GAParch"')
63+
data = f'{GAP_LIB_DIR}:{GAP_SHARE_DIR}'
64+
for path in GAP_LIB_DIR, GAP_SHARE_DIR:
65+
sysinfo = os.path.join(path, "sysinfo.gap")
66+
if os.path.exists(sysinfo):
67+
data += subprocess.getoutput(f'. "{sysinfo}" && echo ":$GAP_VERSION:$GAParch"')
6768
h = hashlib.sha1(data.encode('utf-8')).hexdigest()
68-
return os.path.join(dir, '%s-%s-%s-%s' % (system, name, HOSTNAME, h))
69+
return os.path.join(dir, f'{system}-{name}-{HOSTNAME}-{h}')
6970

7071

7172
def prepare_workspace_dir(dir=None):

0 commit comments

Comments
 (0)