Skip to content

doctest unnecessarily assumes SAGE_VENV/bin contains sage binary #33624

@tornaria

Description

@tornaria

In my setup SAGE_VENV is left unset so it defaults to sys.prefix = '/usr'; in this way, sage uses system python packages (and everything works).

However, the sage binary is not necessarily installed as /usr/bin/sage. For example:

  • I build just sagelib from source, so that the sage python packages are placed in .../pkgs/sagemath-standard/build/lib.linux-x86_64-3.10/ and the sage scripts are placed in .../pkgs/sagemath-standard/build/scripts-3.10/. I want to use and doctest this sagelib without installing (which can be done easily by setting PATH and PYTHONPATH to those directories).

Now /usr/bin/sage may or may not exist (depends on whether I have the system sagemath installed -- this is never true in github CI where the void linux package for sagemath is built and tested in a clean container)

In any case, the directory where the actual sage script is located can be obtained as os.path.dirname(sys.argv[0]) (this will normally be the same as SAGE_VENV/bin).

Component: doctest framework

Author: Gonzalo Tornaría

Branch/Commit: 0c1ca80

Reviewer: Matthias Koeppe

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions