Commit 04363ff
authored
Pass sys.executable to
* Pass sys.executable to `uv venv` if it is the same version
Support the case when pythonX.Y is not in the search path, but
it corresponds to the currently running Python interpreter.
This may happen if e.g. Tox is installed (along with tox-uv) in
a virtual environment that has been created with a Python interpreter
coming from a non-standard location, and then `tox` is invoked
directly from the virtual environment's `bin/` directory:
[roam@straylight ~]$ mkdir ~/not-in-path
[roam@straylight ~]$ uv venv -p /opt/some-vendor/python3/bin/python3 ~/not-in-path/venv
Using Python 3.8.17 interpreter at: /opt/some-vendor/python3/bin/python3
Creating virtualenv at: /home/roam/not-in-path/venv
Activate with: source /home/roam/not-in-path/venv/bin/activate
[roam@straylight ~]$ (set -e; . ~/not-in-path/venv/bin/activate; uv pip install tox tox-uv)
...snip...
[roam@straylight ~]$ printf -- '%s\n' '[testenv]' 'package=skip' 'commands=python3 -c "print()"' > ~/not-in-path/tox.ini
[roam@straylight ~]$ ~/not-in-path/venv/bin/tox -c ~/not-in-path/tox.ini
py: venv /home/roam/not-in-path> venv/bin/uv venv -p 3.8 /home/roam/not-in-path/.tox/py/.venv
× No Python 3.8 in `PATH`. Is Python 3.8 installed?
py: exit 1 (0.01 seconds) /home/roam/not-in-path> venv/bin/uv venv -p 3.8 /home/roam/not-in-path/.tox/py/.venv pid=1059253
py: FAIL code 1 (0.02 seconds)
evaluation failed :( (0.11 seconds)
[roam@straylight ~]$
* Let Ruff know that we try to use subprocess responsibly
* Tox is certainly installed during the test suite runuv venv if it is the same version (#40)1 parent db7196f commit 04363ff
2 files changed
+37
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
117 | 123 | | |
118 | 124 | | |
119 | 125 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
3 | 8 | | |
4 | 9 | | |
5 | 10 | | |
| |||
86 | 91 | | |
87 | 92 | | |
88 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
0 commit comments