-
-
Notifications
You must be signed in to change notification settings - Fork 652
Description
This ticket introduces a new Python package sage_conf
.
- sage-the-distribution will generate this Python package at
./configure
time and install it at build time before starting to build/install sagelib usingsrc/setup.py
. - Distributions will generate and install their own
sage_conf
by a method of their choice before starting to build/install sagelib.
A console_script
allows to query individual variable values from the shell, or output all variables in .env format:
$ local/bin/sage-config MAXIMA
/Users/mkoeppe/s/sage/sage-rebasing/worktree-algebraic-2018-spring/local/bin/maxima
$ local/bin/sage-config
VERSION=9.1.beta0
MAXIMA=/Users/mkoeppe/s/sage/sage-rebasing/worktree-algebraic-2018-spring/local/bin/maxima
SAGE_LOCAL=/Users/mkoeppe/s/sage/sage-rebasing/worktree-algebraic-2018-spring/local
SAGE_ROOT=/Users/mkoeppe/s/sage/sage-rebasing/worktree-algebraic-2018-spring
The module and the script are used as follows:
-
It provides configuration information to sagelib at installation time (
src/setup.py
).Ultimately we want to be able to install sagelib with
pip
. To support installation bypip
from PyPI, from an URL, etc., we cannot expect to configure the build like we do now, by writing the configuration to the filesrc/sage-env-config
. Moreover, if pip is running in--isolated
mode, also no environment variables are passed. Then the only information flow is through arguments topip build
and through the installed Python packages. By installingsage_conf
first, we make the configuration available to the pip install of sagelib. -
It provides configuration information to the docbuild, in particular about the install locations of documentation of external packages.
-
It provides configuration information to the runtime of sagelib, making sagelib more independent from the environment variables set by
src/bin/sage-env
(local/bin/sage-env
).
a. By providing SAGE_LOCAL
as one the configuration variables, it removes assumptions regarding install locations of sagelib
relative to $SAGE_LOCAL
. This enables the following:
-
Installing an experimental version of
sagelib
in other install locations, such as in a user site packages directory. -
Making
sagelib
available in a user's venv, as in the following example:
Without this ticket:$ sage -python -m venv --system-site-packages ~/personal-sage-venv/ $ source ~/personal-sage-venv/bin/activate (personal-sage-venv) $ python >>> import sage.env >>> sage.env.SAGE_LOCAL '/Users/mkoeppe/personal-sage-venv' # wrong >>> import sage.all RuntimeError: You must get the file local/bin/sage-maxima.lisp
With this ticket:
>>> sage.env.SAGE_LOCAL '/Users/mkoeppe/s/sage/sage-rebasing/worktree-algebraic-2018-spring/local' >>> import sage.all >>> sage.all.maxima('1') 1
-
Add configure option --with-sage-venv=SAGE_VENV to create venv there instead of in SAGE_LOCAL #29013/spkg-configure.m4 for python3 #27824: Using the system python3 via spkg-configure.m4
b. For a broader context: see Meta-ticket: Split sage-env into 5 to clean up sage configuration #21707 Task: Splitsage-env
into 5
CC: @kiwifb @antonio-rojas @isuruf @embray @infinity0 @timokau @jdemeyer @dimpase @jhpalmieri @vbraun
Component: build
Author: Matthias Koeppe
Branch: af18a01
Reviewer: Dima Pasechnik, Erik Bray
Issue created by migration from https://trac.sagemath.org/ticket/29038