-
-
Notifications
You must be signed in to change notification settings - Fork 528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doctest unnecessarily assumes SAGE_VENV/bin contains sage
binary
#33624
Comments
comment:1
Doctest failure is:
|
Branch: u/tornaria/33624 |
Author: Gonzalo Tornaría |
Commit: |
New commits:
|
comment:3
Executing stuff out of the |
comment:4
Replying to @mkoeppe:
That's quite unfortunate, since it works very smoothly. In any case, all the issues here and in #33625 would be the same if sagelib is installed to a custom directory (i.e. not PS: in void templates we try to run all tests and checks from upstream as much as possible. However, the standard way is to build and then check from build directory, this is done before packaging. There are no good ways to check packages after installation, I've seen that if a package requires installation to check the void maintainers tend to just disable the check step. |
comment:5
Note that this is not Sage-specific. |
comment:6
Replying to @mkoeppe:
I know, but it does work ok in sagelib right now and it would be a pity to loose it. Still, it seems not quite right to use In our void package we use As I said, all these issues are orthogonal to installing/not installing. Currently my workaround is to delete |
comment:7
Here's a different approach: --- a/src/sage/env.py
+++ b/src/sage/env.py
@@ -167,6 +167,7 @@ SAGE_VERSION_BANNER = var("SAGE_VERSION_BANNER", version.banner)
# virtual environment where sagelib is installed
SAGE_VENV = var("SAGE_VENV", os.path.abspath(sys.prefix))
+SAGE_BIN = var("SAGE_BIN", join(SAGE_VENV, "bin"))
SAGE_LIB = var("SAGE_LIB", os.path.dirname(os.path.dirname(sage.__file__)))
SAGE_EXTCODE = var("SAGE_EXTCODE", join(SAGE_LIB, "sage", "ext_data"))
SAGE_VENV_SPKG_INST = var("SAGE_VENV_SPKG_INST", join(SAGE_VENV, "var", "lib", "sage", "installed"))
diff --git a/src/sage/misc/sage_ostools.pyx b/src/sage/misc/sage_ostools.pyx
index 57c8db69664..18330f94352 100644
--- a/src/sage/misc/sage_ostools.pyx
+++ b/src/sage/misc/sage_ostools.pyx
@@ -32,12 +32,12 @@ def have_program(program, path=None):
True
sage: have_program('there_is_not_a_program_with_this_name')
False
- sage: from sage.env import SAGE_VENV
- sage: have_program('sage', os.path.join(SAGE_VENV, 'bin'))
+ sage: from sage.env import SAGE_BIN
+ sage: have_program('sage', SAGE_BIN)
True
sage: have_program('sage', '/there_is_not_a_path_with_this_name')
False
- sage: have_program('there_is_not_a_program_with_this_name', os.path.join(SAGE_VENV, 'bin'))
+ sage: have_program('there_is_not_a_program_with_this_name', SAGE_BIN)
False
"""
if path is None: What do you think? This is now really a no-op, except now I can easily override |
comment:8
|
comment:9
The whole practice of using |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:11
Replying to @mkoeppe:
I redid the patch with that in mind. Now we test Since sage ships some scripts with |
Reviewer: Matthias Koeppe |
comment:12
LGTM |
Changed branch from u/tornaria/33624 to |
In my setup
SAGE_VENV
is left unset so it defaults tosys.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:.../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 asos.path.dirname(sys.argv[0])
(this will normally be the same asSAGE_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
The text was updated successfully, but these errors were encountered: