Skip to content

src/bin/sage-env: Make sure $SAGE_VENV/bin is at the beginning of the PATH #30013

@mkoeppe

Description

@mkoeppe

Follow-up from #25486 (Discover SAGE_SCRIPTS_DIR to make $SAGE_LOCAL/bin/sage work from any directory, in an environment without SAGE_* variables) and #22731.

We make sure that $SAGE_VENV/bin (from #22731) appears at the beginning of the PATH. For virtual environments such as those set up by tox (#29950), this may be different from and should take precedence over $SAGE_LOCAL/bin. This will ensure that

  • the correct copy of auxiliary scripts such as sage-eval is invoked by sage;
  • the correct copy of python3 is run.

To determine SAGE_VENV:

  • If src/bin/sage is invoked directly out of the source tree, it will run a new non-installed configure-generated script sage-src-env-config
  • An installed sage script installed by setup.py in SAGE_LOCAL or in a venv will run a Python script sage-venv-config instead.

Depends on #29852

CC: @orlitzky @jhpalmieri

Component: scripts

Keywords: sd111

Author: Matthias Koeppe

Branch: 0140f84

Reviewer: Tobias Diez, Dima Pasechnik

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions