Skip to content

Commit e115716

Browse files
tornariadimpase
authored andcommitted
gap_workspace_file: include hostname and gap version
1 parent 5919d54 commit e115716

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/sage/interfaces/gap_workspace.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
import os
1717
import time
1818
import hashlib
19-
from sage.env import DOT_SAGE, SAGE_LOCAL
19+
import subprocess
20+
from sage.env import DOT_SAGE, SAGE_LOCAL, HOSTNAME, GAP_ROOT_DIR
2021

2122

2223
def gap_workspace_file(system="gap", name="workspace", dir=None):
@@ -59,8 +60,12 @@ def gap_workspace_file(system="gap", name="workspace", dir=None):
5960
if dir is None:
6061
dir = os.path.join(DOT_SAGE, 'gap')
6162

62-
h = hashlib.sha1(SAGE_LOCAL.encode('utf-8')).hexdigest()
63-
return os.path.join(dir, '%s-%s-%s' % (system, name, h))
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"')
67+
h = hashlib.sha1(data.encode('utf-8')).hexdigest()
68+
return os.path.join(dir, '%s-%s-%s-%s' % (system, name, HOSTNAME, h))
6469

6570

6671
def prepare_workspace_dir(dir=None):

0 commit comments

Comments
 (0)