|
17 | 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
18 | 18 |
|
19 | 19 |
|
20 |
| -# Set SAGE_ROOT to the location of the sage install, i.e. the directory |
21 |
| -# containing this shell script. If unset, we will try to figure it out |
22 |
| -# automatically. |
23 |
| -#SAGE_ROOT=/path/to/sage-version |
24 |
| - |
25 | 20 | # Resolve all symbolic links in a filename. This more or less behaves
|
26 | 21 | # like "readlink -f" except that it does not convert the filename to an
|
27 | 22 | # absolute path (a relative path remains relative), nor does it treat
|
28 | 23 | # "." or ".." specially.
|
29 | 24 | #
|
30 | 25 | # WARNING: this function is copy/pasted from src/bin/sage-env, and
|
31 |
| -# deserves to be factored out at some point in the future. In the |
32 |
| -# meantime however the two should be kept synchronized. |
| 26 | +# would deserve to be factored out if we could -- but we need it here so |
| 27 | +# we can actually find other files in SAGE_ROOT! |
| 28 | +# The copies should be kept synchronized. |
33 | 29 | resolvelinks() {
|
34 | 30 | # $in is what still needs to be converted (normally has no starting slash)
|
35 | 31 | in="$1"
|
@@ -104,16 +100,20 @@ resolvelinks() {
|
104 | 100 | echo "$out"
|
105 | 101 | }
|
106 | 102 |
|
107 |
| -# If SAGE_ROOT is not given, find it out from $0 |
108 |
| -if [ -z "$SAGE_ROOT" ]; then |
109 |
| - # Get the path to $0 (this shell script) with all symbolic links |
110 |
| - # resolved |
111 |
| - SAGE_ROOT=`resolvelinks "$0"` || \ |
| 103 | +# Determine SAGE_ROOT from $0. This is so we can find the src/bin/sage script. |
| 104 | +# |
| 105 | +# This uses "resolvelinks" to support the use case of symlinking this script |
| 106 | +# into a directory that is in PATH, which was longstanding recommended practice. |
| 107 | +# |
| 108 | +# (The updated README.md and installation manual from Trac #33787 recommend to |
| 109 | +# symlink the installed version of the src/bin/sage script instead.) |
| 110 | + |
| 111 | +# Get the path to $0 (this shell script) with all symbolic links resolved |
| 112 | +SAGE_ROOT=`resolvelinks "$0"` || \ |
112 | 113 | SAGE_ROOT="$0"
|
113 | 114 |
|
114 |
| - # Get the directory component |
115 |
| - SAGE_ROOT="${SAGE_ROOT%/*}" |
116 |
| -fi |
| 115 | +# Get the directory component |
| 116 | +SAGE_ROOT="${SAGE_ROOT%/*}" |
117 | 117 |
|
118 | 118 | # Make SAGE_ROOT absolute
|
119 | 119 | SAGE_ROOT=`cd "$SAGE_ROOT" && pwd -P`
|
|
0 commit comments