Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
29446: improve handling of SAGE_ROOT to avoid symbolic links
Browse files Browse the repository at this point in the history
With this change, SAGE_ROOT will always be the physical path, even if
the current directory when compiling Sage is a symbolic link
(non-physical path) to Sage's root directory.

In particular, this fixes a test failure in src/sage/env.py when Sage
was built from the symbolic/non-physical path.
  • Loading branch information
mwageringel committed Jul 15, 2020
1 parent 467fbc7 commit 20f564e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build/pkgs/sage_conf/src/sage_conf.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SAGE_NAUTY_BINS_PREFIX = "@SAGE_NAUTY_BINS_PREFIX@"
# The following must not be used during build to determine source or installation
# location of sagelib. See comments in SAGE_ROOT/src/Makefile.in
SAGE_LOCAL = "@prefix@"
SAGE_ROOT = "@abs_top_srcdir@"
SAGE_ROOT = "@SAGE_ROOT@"

# Entry point 'sage-config'. It does not depend on any packages.

Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ AC_CONFIG_MACRO_DIR([m4])

# Assume current directory is SAGE_ROOT.
SAGE_ROOT=`pwd -P`
AC_SUBST(SAGE_ROOT)

SAGE_LOCAL="$prefix"
# The following line is necessary because the code below
Expand Down
2 changes: 1 addition & 1 deletion src/bin/sage-env-config.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export SAGE_ENV_CONFIG_SOURCED=1
export SAGE_LOCAL="@prefix@"

# SAGE_ROOT is the location of the Sage source/build tree.
export SAGE_ROOT="@abs_top_srcdir@"
export SAGE_ROOT="@SAGE_ROOT@"

#######################################
# Compilers set at configuration time
Expand Down
3 changes: 2 additions & 1 deletion src/sage/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
- \R. Andrew Ohana (2012): Initial version.
Verify that importing ``sage.all`` works in Sage's Python without any ``SAGE_``
environment variables, and has the same ``SAGE_ROOT`` and ``SAGE_LOCAL``::
environment variables, and has the same ``SAGE_ROOT`` and ``SAGE_LOCAL``
(see also :trac:`29446`)::
sage: env = {k:v for (k,v) in os.environ.items() if not k.startswith("SAGE_")}
sage: from subprocess import check_output
Expand Down

0 comments on commit 20f564e

Please sign in to comment.