Skip to content
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

sage.features.Executable: Prepend $SAGE_VENV/bin:$SAGE_LOCAL/bin to PATH #31296

Closed
mkoeppe opened this issue Jan 26, 2021 · 53 comments
Closed

sage.features.Executable: Prepend $SAGE_VENV/bin:$SAGE_LOCAL/bin to PATH #31296

mkoeppe opened this issue Jan 26, 2021 · 53 comments

Comments

@mkoeppe
Copy link
Contributor

mkoeppe commented Jan 26, 2021

Follow-up from #22731.

This is so that Sage becomes fully functional even when not being run from within sage-env (which sets PATH)

Of course, PATH is not actually manipulated, only Executable finds the executable in more places.

As an illustration, we update sage.interfaces.four_ti_2 and sage.interfaces.latte to use Executable.absolute_filename() from #31292. Then, after sage -i 4ti2 latte_int, the following works with this ticket:

$ venv/bin/python3 -c 'import sage.all; from sage.interfaces.four_ti_2 import four_ti_2; print(four_ti_2.groebner(lat=[[1,2,3],[1,1,1]]))'
$ venv/bin/python3 -c 'from sage.all import *; print(Polyhedron([[-3, 0], [0, 9]]).volume(measure="induced_rational"))'
3

In follow-up tickets, other code that calls executables needs to be updated to use Executable.absolute_path() from #31292. The first tickets to do so are #33440, #33465, #33466, #32645, #33467, #33405.

This is work towards:

Depends on #31292

CC: @tobiasdiez @kiwifb @tobihan @antonio-rojas @orlitzky

Component: build: configure

Author: Matthias Koeppe

Branch/Commit: 160e9af

Reviewer: Dima Pasechnik, Tobias Diez

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

@mkoeppe mkoeppe added this to the sage-9.3 milestone Jan 26, 2021
@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 24, 2021

comment:2

Sage development has entered the release candidate phase for 9.3. Setting a new milestone for this ticket based on a cursory review of ticket status, priority, and last modification date.

@mkoeppe mkoeppe modified the milestones: sage-9.3, sage-9.4 Mar 24, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.4, sage-9.5 Jul 19, 2021
@mkoeppe
Copy link
Contributor Author

mkoeppe commented Sep 25, 2021

Dependencies: #32565

@mkoeppe mkoeppe modified the milestones: sage-9.5, sage-9.6 Dec 14, 2021
@mkoeppe
Copy link
Contributor Author

mkoeppe commented Dec 21, 2021

Changed dependencies from #32565 to none

@mkoeppe mkoeppe changed the title sage.features.Executable: Prepend $SAGE_VENV/bin:$SAGE_LOCAL/bin to PATH, remove dependency on distutils sage.features.Executable: Prepend $SAGE_VENV/bin:$SAGE_LOCAL/bin to PATH Dec 21, 2021
@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 1, 2022

Dependencies: #31292

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 1, 2022

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 1, 2022

Author: Matthias Koeppe

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 1, 2022

New commits:

32ce831sage.features.Executable.absolute_path: New
88860d3sage.features.Executable.absolute_path: If SAGE_LOCAL != SAGE_VENV, search first in SAGE_VENV/bin, SAGE_LOCAL/bin, then PATH

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 1, 2022

Commit: 88860d3

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 2, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

8801359src/sage/features/__init__.py: Fix import

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 2, 2022

Changed commit from 88860d3 to 8801359

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 2, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

403bcc1sage.features.Executable: Fix up

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 2, 2022

Changed commit from 8801359 to 403bcc1

@mkoeppe

This comment has been minimized.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 2, 2022

Changed commit from 403bcc1 to 9fad95e

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 2, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

8bb7e3asrc/sage/features/__init__.py: Relax doctest
9fad95eMerge #31292

@tobiasdiez
Copy link
Contributor

comment:14

Please extract

            sage_venv = Path(SAGE_VENV)
            sage_local = Path(SAGE_LOCAL)

to a central place (I would say sage.env but you probably don't like this) for easier reuse in similar situations.

PATH = ':'.join(str(p) for p in [sage_venv / 'bin', sage_local / 'bin'])

this is a normal variable and thus should be lowercase.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 3, 2022

comment:24

Replying to @tobiasdiez:

sage.features.FileFeature: Replace method absolute_path by absolute_filename, with deprecation

So the plan of this is to deprecate absolute_path, then when everyone uses absolute_filename, change absolute_path to return path and then deprecate absolute_filename? Doesn't this procedure take very long?

Yes, a year, what's the rush?

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 3, 2022

comment:25

Replying to @tobiasdiez:

What about adding an optional as_path = false argument (with deprecation if its false).

Writing that is no easier than wrapping Path(...) around the result -- and the result is not type-stable

@mkoeppe

This comment has been minimized.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 5, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

a4d0ed6sage.interfaces.four_ti_2: Use Executable.absolute_filename

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 5, 2022

Changed commit from 9266709 to a4d0ed6

@mkoeppe

This comment has been minimized.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 5, 2022

Changed commit from a4d0ed6 to 4252ea3

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 5, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

4252ea3sage.sandpiles.sandpile: Use Executable.absolute_filename() when interfacing 4ti2

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 5, 2022

Changed commit from 4252ea3 to 17b9fde

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 5, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

17b9fdesage.interfaces.latte: Use Executable.absolute_filename

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@dimpase
Copy link
Member

dimpase commented Mar 6, 2022

comment:36

I presume the latte doctest patch #33467 comment:4
should come here.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 6, 2022

comment:37

Yes, that's right, can you push it to the ticket please?

@dimpase
Copy link
Member

dimpase commented Mar 6, 2022

comment:38

later today, will do.

@dimpase
Copy link
Member

dimpase commented Mar 6, 2022

Changed commit from 17b9fde to d1cf739

@dimpase
Copy link
Member

dimpase commented Mar 6, 2022

New commits:

d1cf739correct latte doctests where calling with abs. names happens

@dimpase
Copy link
Member

dimpase commented Mar 6, 2022

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 7, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

160e9affix doctest for more invocation of count

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 7, 2022

Changed commit from d1cf739 to 160e9af

@dimpase
Copy link
Member

dimpase commented Mar 7, 2022

Reviewer: Dima Pasechnik, Tobias Diez

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 7, 2022

comment:42

Thank you!

@vbraun
Copy link
Member

vbraun commented Mar 9, 2022

Changed branch from u/dimpase/sage_features_executable_SAGE_LOCAL to 160e9af

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants