Skip to content

Commit

Permalink
sage.env, sage.misc.package: Use SAGE_LOCAL_SPKG_INST to avoid clash …
Browse files Browse the repository at this point in the history
…with SAGE_SPKG_INST set by sage-spkg
  • Loading branch information
Matthias Koeppe committed Dec 16, 2023
1 parent e2e0f8d commit 3350f7f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/bin/sage-env
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ fi
# depending on SAGE_ROOT and SAGE_LOCAL which are already defined.
if [ -n "$SAGE_LOCAL" ]; then
export SAGE_SHARE="$SAGE_LOCAL/share"
export SAGE_SPKG_INST="$SAGE_LOCAL/var/lib/sage/installed"
export SAGE_SPKG_INST="$SAGE_LOCAL/var/lib/sage/installed" # deprecated
fi
if [ -n "$SAGE_SHARE" ]; then
export SAGE_DOC="$SAGE_SHARE/doc/sage"
Expand Down
3 changes: 2 additions & 1 deletion src/sage/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ def var(key: str, *fallbacks: Optional[str], force: bool = False) -> Optional[st
SAGE_LOCAL = var("SAGE_LOCAL", SAGE_VENV)
SAGE_SHARE = var("SAGE_SHARE", join(SAGE_LOCAL, "share"))
SAGE_DOC = var("SAGE_DOC", join(SAGE_SHARE, "doc", "sage"))
SAGE_SPKG_INST = var("SAGE_SPKG_INST", join(SAGE_LOCAL, "var", "lib", "sage", "installed"))
SAGE_LOCAL_SPKG_INST = var("SAGE_LOCAL_SPKG_INST", join(SAGE_LOCAL, "var", "lib", "sage", "installed"))
SAGE_SPKG_INST = var("SAGE_SPKG_INST", join(SAGE_LOCAL, "var", "lib", "sage", "installed")) # deprecated

# source tree of the Sage distribution
SAGE_ROOT = var("SAGE_ROOT") # no fallback for SAGE_ROOT
Expand Down
4 changes: 2 additions & 2 deletions src/sage/misc/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ def _spkg_inst_dirs():
"""
Generator for the installation manifest directories as resolved paths.
It yields first ``SAGE_SPKG_INST``, then ``SAGE_VENV_SPKG_INST``,
It yields first ``SAGE_LOCAL_SPKG_INST``, then ``SAGE_VENV_SPKG_INST``,
if defined; but it both resolve to the same directory, it only yields
one element.
Expand All @@ -402,7 +402,7 @@ def _spkg_inst_dirs():
"""
last_inst_dir = None
for inst_dir in (sage.env.SAGE_SPKG_INST, sage.env.SAGE_VENV_SPKG_INST):
for inst_dir in (sage.env.SAGE_LOCAL_SPKG_INST, sage.env.SAGE_VENV_SPKG_INST):
if inst_dir:
inst_dir = Path(inst_dir).resolve()
if inst_dir.is_dir() and inst_dir != last_inst_dir:
Expand Down

0 comments on commit 3350f7f

Please sign in to comment.