From 2bce7b8fd7c426abab050000ae1c76e7e24df182 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 12 Nov 2020 18:05:40 -0800 Subject: [PATCH 1/2] src/bin/sage: Find SAGE_ROOT, SAGE_LOCAL from sage-config --- src/bin/sage | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/bin/sage b/src/bin/sage index 5652b9d6fd3..678b31f9d4e 100755 --- a/src/bin/sage +++ b/src/bin/sage @@ -196,6 +196,11 @@ fi # append -env to that). We redirect stdout to stderr, which is safer # for scripts. ##################################################################### +if [ -x "$0-config" ]; then + # optional sage-config console script, installed by sage_conf + export SAGE_ROOT=$("$0-config" SAGE_ROOT) + export SAGE_LOCAL=$("$0-config" SAGE_LOCAL) +fi if [ -f "$0-env-config" ]; then # As of Trac #22731, sage-env-config is optional. . "$0-env-config" >&2 From 9810f492a246441d7c570a1010558e38c1fc30ad Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 12 Nov 2020 18:12:30 -0800 Subject: [PATCH 2/2] src/bin/sage: Determine SAGE_ROOT, SAGE_LOCAL earlier --- src/bin/sage | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/bin/sage b/src/bin/sage index 678b31f9d4e..829371a49f3 100755 --- a/src/bin/sage +++ b/src/bin/sage @@ -58,6 +58,17 @@ usage() { # 'usage_advanced', which prints a longer help message, is defined # below, after sourcing sage-env. +# Determine SAGE_ROOT and SAGE_LOCAL. +if [ -x "$0-config" ]; then + # optional sage-config console script, installed by sage_conf + export SAGE_ROOT=$("$0-config" SAGE_ROOT) + export SAGE_LOCAL=$("$0-config" SAGE_LOCAL) +fi +if [ -f "$0-env-config" ]; then + # As of Trac #22731, sage-env-config is optional. + . "$0-env-config" >&2 +fi + ##################################################################### # Special options to be processed without sage-env ##################################################################### @@ -196,15 +207,6 @@ fi # append -env to that). We redirect stdout to stderr, which is safer # for scripts. ##################################################################### -if [ -x "$0-config" ]; then - # optional sage-config console script, installed by sage_conf - export SAGE_ROOT=$("$0-config" SAGE_ROOT) - export SAGE_LOCAL=$("$0-config" SAGE_LOCAL) -fi -if [ -f "$0-env-config" ]; then - # As of Trac #22731, sage-env-config is optional. - . "$0-env-config" >&2 -fi if [ -f "$0-env" ]; then . "$0-env" >&2 if [ $? -ne 0 ]; then