Skip to content

Commit

Permalink
Trac #14750: sysconfdir not respected/implemented
Browse files Browse the repository at this point in the history
Configuration files should be placed into 'sysconfdir' [1]. Files such
as gprc.expect in $(SAGE_LOCAL)/etc or default.qepcadrc in $(SAGE_LOCAL)
will break future sagelib packaging.
SAGE_LOCAL will supposedly be set to 'prefix' for Sage-the-library
packages.

It might make sense to add SAGE_ETC=sysconfdir to the environment (and
use that whereever appropriate). sysconfdir defaults to prefix/etc
(=SAGE_LOCAL/etc) but can be overridden for custom installations.

[1] www.gnu.org/prep/standards/html_node/Directory-Variables.html‎

URL: http://trac.sagemath.org/14750
Reported by: felixs
Ticket author(s): Felix Salfelder
Reviewer(s): Nathann Cohen
  • Loading branch information
Release Manager authored and vbraun committed Dec 17, 2013
2 parents 40f1dc2 + 573b23e commit fa7fb49
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/bin/sage-env
Expand Up @@ -246,6 +246,7 @@ fi

# Setting Sage-related location environment variables.
export SAGE_LOCAL="$SAGE_ROOT/local"
export SAGE_ETC="$SAGE_LOCAL/etc"
export SAGE_SHARE="$SAGE_LOCAL/share"
export SAGE_EXTCODE="$SAGE_SHARE/sage/ext"
export SAGE_SPKG_INST="$SAGE_LOCAL/var/lib/sage/installed"
Expand Down
1 change: 1 addition & 0 deletions src/sage/env.py
Expand Up @@ -87,6 +87,7 @@ def _add_variable_or_fallback(key, fallback, force=False):
# bunch of sage directories and files
_add_variable_or_fallback('SAGE_ROOT', None)
_add_variable_or_fallback('SAGE_LOCAL', opj('$SAGE_ROOT', 'local'))
_add_variable_or_fallback('SAGE_ETC', opj('$SAGE_LOCAL', 'etc'))
_add_variable_or_fallback('SAGE_SHARE', opj('$SAGE_LOCAL', 'share'))

# SAGE_LIB is the site-packages directory if the sage library
Expand Down
6 changes: 3 additions & 3 deletions src/sage/interfaces/gp.py
Expand Up @@ -977,11 +977,11 @@ def is_GpElement(x):
"""
return isinstance(x, GpElement)

from sage.env import DOT_SAGE, SAGE_LOCAL
from sage.env import DOT_SAGE, SAGE_ETC
import os

# Set GPRC environment variable to $SAGE_LOCAL/etc/gprc.expect
os.environ["GPRC"] = os.path.join(SAGE_LOCAL, 'etc', 'gprc.expect')
# Set GPRC environment variable to $SAGE_ETC/gprc.expect
os.environ["GPRC"] = os.path.join(SAGE_ETC, 'gprc.expect')

# An instance
gp = Gp(logfile=os.path.join(DOT_SAGE,'gp-expect.log')) # useful for debugging!
Expand Down

0 comments on commit fa7fb49

Please sign in to comment.