Ticket #552 (closed defect: fixed)
[with patch; positive review] come up with a better way of deciding whether or not the SAGE install has moved
| Reported by: | was | Owned by: | was |
|---|---|---|---|
| Priority: | major | Milestone: | sage-3.2 |
| Component: | packages | Keywords: | |
| Cc: | Author(s): | ||
| Report Upstream: | Reviewer(s): | ||
| Merged in: | Work issues: |
Description
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, ''
Any better ideas???
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

