Re: [sage-devel] Re: export SAGE_ROOT from '$SAGE_LOCAL/bin/sage'

2022-05-16 Thread Matthias Koeppe
On Monday, May 16, 2022 at 9:12:53 PM UTC-7 hohoa...@gmail.com wrote:

> Is it this snippet, would you please elaborate?
>
> 
> # Make sure that SAGE_ROOT is either an absolute physical directory name
> # or empty.
> if [ -n "$SAGE_ROOT" ]; then
> export SAGE_ROOT=$(cd "$SAGE_ROOT" 2>/dev/null && pwd -P)
> fi
> 
>

Yes. You asked what happens when SAGE_ROOT has disappeared.
Well, in this case, after these lines are run, SAGE_ROOT will be empty.

BTW, it is rather confusing to see in '$SAGE_LOCAL/bin/sage':
>
> if [ -f "${SELF}-env-config" ]; then
> # As of Trac #22731, sage-env-config is optional.
> . "${SELF}-env-config" >&2
> fi
>
> again export SAGE_ROOT and SAGE_LOCAL (same as in the original question, 
> about 10 lines below)
>
 
It is actually $SAGE_VENV/bin/sage. When this script is invoked directly, 
it does not know about SAGE_ROOT. It first sources 
$SAGE_LOCAL/bin/sage-config to find the value of SAGE_ROOT and SAGE_LOCAL. 
Afterwards it sources $SAGE_LOCAL/bin/sage-env-config (and then 
$SAGE_LOCAL/bin/sage-env) to find the value of SAGE_ROOT and SAGE_LOCAL.

There is some redundancy there. sage-config is relatively new (it was added 
in https://trac.sagemath.org/ticket/29038), and it might be that in some 
downstream packaging of Sage it is not installed. sage-env-config has been 
around for a longer time, and eventually we may want to get rid of it.
See https://trac.sagemath.org/ticket/21707 for an overview of this work.
 

> Is it a prerequisite that $SAGE_ROOT be part of the installation and it 
> must stay as long as $SAGE_LOCAL is around?
>

No, it is not required. SAGE_LOCAL is a self-contained installation 
hierarchy. If you use "configure --prefix=..." to set SAGE_LOCAL to a 
directory outside of SAGE_ROOT, then it is OK to delete SAGE_ROOT 
afterwards. After you delete it, of course the commands that need 
SAGE_ROOT, such as "sage -i" for package installation, are no longer 
available.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/05b0133d-c125-4f5c-b8b7-eeb3a9b63561n%40googlegroups.com.


Re: [sage-devel] Re: export SAGE_ROOT from '$SAGE_LOCAL/bin/sage'

2022-05-16 Thread ph h
Hi,

Is it this snippet, would you please elaborate?


# Make sure that SAGE_ROOT is either an absolute physical directory name
# or empty.
if [ -n "$SAGE_ROOT" ]; then
export SAGE_ROOT=$(cd "$SAGE_ROOT" 2>/dev/null && pwd -P)
fi


BTW, it is rather confusing to see in '$SAGE_LOCAL/bin/sage':

if [ -f "${SELF}-env-config" ]; then
# As of Trac #22731, sage-env-config is optional.
. "${SELF}-env-config" >&2
fi

again export SAGE_ROOT and SAGE_LOCAL (same as in the original question,
about 10 lines below)

Many references to $SAGE_ROOT in  '$SAGE_LOCAL/bin/sage'.

Is it a prerequisite that $SAGE_ROOT be part of the installation and it
must stay as long as $SAGE_LOCAL is around?
Or these parts of  '$SAGE_LOCAL/bin/sage'. should be factored out?

Thank you for your help.

Regards,

phiho







On Mon, May 16, 2022 at 11:14 PM Matthias Koeppe 
wrote:

> On Monday, May 16, 2022 at 8:07:48 PM UTC-7 hohoa...@gmail.com wrote:
>
>> Please advise the use of SAGE_ROOT when it is exported
>> from  '$SAGE_LOCAL/bin/sage':
>>
>> # Determine SAGE_ROOT, SAGE_LOCAL, and SAGE_VENV.
>> unset SAGE_VENV
>> if [ -x "${SELF}-config" ]; then
>> # optional sage-config console script, installed by sage_conf
>> export SAGE_ROOT=$("${SELF}-config" SAGE_ROOT)
>> export SAGE_LOCAL=$("${SELF}-config" SAGE_LOCAL)
>> fi
>>
>> What if $SAGE_ROOT was deleted?
>>
>
> see src/bin/sage-env around line 111
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-devel/68b66f75-0fec-4e9b-bca3-e2ee04bde2e8n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/CALZQg1ZAVyzCJe8wtBmh02W9Z29XojDP0dH2fNvHqhU1sj1r8g%40mail.gmail.com.


[sage-devel] Re: export SAGE_ROOT from '$SAGE_LOCAL/bin/sage'

2022-05-16 Thread Matthias Koeppe
On Monday, May 16, 2022 at 8:07:48 PM UTC-7 hohoa...@gmail.com wrote:

> Please advise the use of SAGE_ROOT when it is exported 
> from  '$SAGE_LOCAL/bin/sage':
>
> # Determine SAGE_ROOT, SAGE_LOCAL, and SAGE_VENV.
> unset SAGE_VENV
> if [ -x "${SELF}-config" ]; then
> # optional sage-config console script, installed by sage_conf
> export SAGE_ROOT=$("${SELF}-config" SAGE_ROOT)
> export SAGE_LOCAL=$("${SELF}-config" SAGE_LOCAL)
> fi
>
> What if $SAGE_ROOT was deleted?
>

see src/bin/sage-env around line 111
 

 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/68b66f75-0fec-4e9b-bca3-e2ee04bde2e8n%40googlegroups.com.