Opened 4 years ago
Last modified 3 years ago
#27040 closed enhancement
Cleanup sage.env — at Version 13
Reported by: | Snark | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-8.7 |
Component: | porting | Keywords: | |
Cc: | infinity0, thansen | Merged in: | |
Authors: | Jeroen Demeyer | Reviewers: | |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
sage.all
should be importable and mostly usable even if no environment variables likeSAGE_ROOT
orSAGE_LOCAL
are set.
- Some unneeded variables are removed.
- Get rid of the over-engineered
$VAR
replacement stuff.
- In some places,
SAGE_LIB
(installed location of Sage) can be used instead ofSAGE_SRC
.
- Determine
SAGE_LIB
not fromsite-packages
but fromsage.__file__
Change History (13)
comment:1 Changed 4 years ago by
- Type changed from PLEASE CHANGE to enhancement
comment:2 follow-up: ↓ 4 Changed 4 years ago by
comment:3 Changed 4 years ago by
- Description modified (diff)
comment:4 in reply to: ↑ 2 Changed 4 years ago by
Replying to fbissey:
SAGE_ROOT is harder. It doesn't correspond to any configuration features of anything. At best it is
SAGE_LOCAL/..
. Any corners in which that wouldn't be true?
One place where the SAGE_LOCAL/..
pattern does not hold is the Debian package, where SAGE_LOCAL=/usr
but SAGE_ROOT=/usr/share/sagemath
. Moreover, on Debian SAGE_SCRIPTS_DIR
is $SAGE_ROOT/bin
rather than the more typical $SAGE_LOCAL/bin
.
comment:5 follow-up: ↓ 6 Changed 4 years ago by
I see. debian choose to do something like that. In sage-on-gentoo SAGE_ROOT points to a location where there used to be something but is now empty. Does debian use SAGE_ROOT anywhere else? Otherwise they could just define SAGE_SCRIPTS_DIR directly.
comment:6 in reply to: ↑ 5 Changed 4 years ago by
Replying to fbissey:
Does debian use SAGE_ROOT anywhere else? Otherwise they could just define SAGE_SCRIPTS_DIR directly.
To clarify, Debian doesn't change anything in env.py
related to SAGE_SCRIPTS_DIR
; the only fallback there is $SAGE_LOCAL/bin
which does not contain the relevant scripts. Instead, in /usr/share/sagemath/bin/sage-env
they manually set SAGE_ROOT=/usr/share/sagemath/
and SAGE_SCRIPTS_DIR=/usr/share/sagemath/bin
.
On Debian, I tried setting SAGE_ROOT
to a garbage value in sage-env
, and Sage still started and worked fine near as I can tell.
comment:7 Changed 4 years ago by
I can see it now. In vanilla sage SAGE_SCRIPTS_DIR
is only set in sage-env and used to source sage-env-config
. But I certainly know that debian has plan for that folder.
So as far as we can see, it would be fine to set SAGE_ROOT
in env.py
. But it could probably be left as is without impacting anything and doing from sage import all
in python should work without setting it.
Looking at it there is one thing I have set SAGE_ROOT
for! sage/misc/copying.py
tries to access SAGE_ROOT/COPYING.txt
. So its current value in sage-on-gentoo is just so that bit works :) I need to change that to be more conformant to Gentoo policies.
There is a somewhat harmless appearance of SAGE_ROOT
in sage/misc/citation.pyx
. There is a more disturbing one in sage/misc/persist.pyx
where I would have used DOT_SAGE
to be honest. The rest is mostly doctesting, packaging, doctests themselves and documentation strings.
comment:8 Changed 4 years ago by
- Component changed from scripts to porting
- Description modified (diff)
- Priority changed from trivial to major
comment:9 Changed 4 years ago by
comment:10 Changed 4 years ago by
- Description modified (diff)
- Summary changed from Make env.py use system values instead of using seeds to Cleanup sage.env
comment:11 Changed 4 years ago by
- Description modified (diff)
comment:12 Changed 4 years ago by
- Description modified (diff)
Scope extension. That's brave! I notice you mention SAGE_SRC
and SAGE_LIB
, is it because you spotted I have
_add_variable_or_fallback('SAGE_SRC', opj('$SAGE_LIB'))
in sage-on-gentoo? I override it with the appropriate value during build of course. But it should work in most places.
comment:13 Changed 4 years ago by
- Description modified (diff)
SAGE_ROOT is harder. It doesn't correspond to any configuration features of anything. At best it is
SAGE_LOCAL/..
. Any corners in which that wouldn't be true?