You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All too often, because of symlinks, etc., my script for detecting whether or not the SAGE install
tree has moved gets it wrong. This is frickin' annoying. I would like a way to determine this
that is much more intelligent.
The relevant code is SAGE_ROOT/local/bin/sage-location:
#!/usr/bin/env sage.bin
import os
SAGE_ROOT = os.environ['SAGE_ROOT']
location_file = '%s/local/lib/sage-current-location.txt'%SAGE_ROOT
def install_moved():
if not os.path.exists(location_file):
O = open(location_file,'w')
O.write(SAGE_ROOT)
O.close()
return False, '' # first time -- so no need to update; this was during the build.
O = open(location_file)
R = O.read().strip()
O.close()
if os.path.abspath(R) != os.path.abspath(SAGE_ROOT): # really different
return True, R # it moved
return False, ''
We can use the shell program "readlink" since that follows symbolic links and friends. We already use it in the sage script to determine the actual location of the sage script.
All too often, because of symlinks, etc., my script for detecting whether or not the SAGE install
tree has moved gets it wrong. This is frickin' annoying. I would like a way to determine this
that is much more intelligent.
The relevant code is SAGE_ROOT/local/bin/sage-location:
Any better ideas???
Component: packages: standard
Issue created by migration from https://trac.sagemath.org/ticket/552
The text was updated successfully, but these errors were encountered: