Skip to content

Replace "$SAGE_LOCAL/bin" by more specific variables to make Sage easier to package, use in venvs #22731

@tobihan

Description

@tobihan

Various scripts refer to "$SAGE_LOCAL/bin" in a way that conflates several different uses. We introduce new variables to give packagers more flexibility without having to patch, and to enable new installation schemes, including the use of Sage in users' venvs.

1a. Introduce $SAGE_BIN as the place where the binaries of all the SPKGs get installed to. Default is $SAGE_LOCAL/bin/.

1b. (Wishlist item:) Make it configurable through ./configure --bindir, but this would need major changes to spkg-configure scripts. (Supporting --bindir would be another step toward more autotools compliance, see Meta-ticket #21566.)

2a. Scripts such as src/bin/sage, src/bin/sage-eval are installed by the sagelib package using the scripts facility of distutils/setuptools. If sagelib is installed into a venv, these scripts are installed into the bin directory of the venv. For the default installation in sage-the-distribution --with-system-python, this venv is identical with SAGE_LOCAL. But if other venvs are created by the user, it will be unrelated to SAGE_LOCAL; in fact, SAGE_LOCAL may be undefined (in distribution packaging and when installing sagelib through pip). As proposed in #29013, we use the variable SAGE_VENV for this, so these scripts would be referred to as $SAGE_VENV/bin/sage-eval etc.

2b. Referring to the python3 used for sage. Likewise, this comes from the venv, not $SAGE_LOCAL/bin. So it should be referred to as $SAGE_VENV/bin/python3.

2c. The subset of the scripts in src/bin, currently installed by the sagelib package, that are "libexec"-like (not user-facing). Distribution packagers would like to hide these scripts. (In the old description of this ticket, it was proposed to use $SAGE_SCRIPTS_DIR for this, but a more specific name is needed: We will use $SAGE_VENV_SCRIPTS_DIR.)

In this ticket, we introduce SAGE_VENV for 2abc, ignoring the "libexec" aspect (using $SAGE_VENV/bin directly instead of going through SAGE_VENV_SCRIPTS_DIR). Items 1 and the libexec aspect of 2c can be done on follow-up tickets.

We also make sage-env-config optional from the viewpoint of the other scripts. This is preparation for #29850 / #29852.

See also:

Depends on #29951

CC: @mkoeppe @jhpalmieri @orlitzky @tobiasdiez @isuruf @antonio-rojas @mwageringel

Component: porting

Author: Matthias Koeppe

Branch/Commit: 38eebc3

Reviewer: Tobias Diez, Dima Pasechnik

Issue created by migration from https://trac.sagemath.org/ticket/22731

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions