fix: support uv venv backend under MSYS2/MinGW (#1088)#1117
Conversation
…MinGW Assisted-by: ClaudeCode:claude-opus-4.8
|
🤖 AI text below 🤖 Pushed one commit adding MinGW-host test corrections ( For context: #1122 stands up that MSYS2 job and acts as a real-host demonstration of this PR. Without this PR, #1122 shows the #1088 symptom directly — |
e31b38e to
82cef5a
Compare
|
🤖 AI text below 🤖 Correction to my earlier comment: the MinGW-host test corrections ( The relationship is unchanged: #1122 stands up the MSYS2 job and demonstrates this PR on a real host. With its own corrections in place, #1122's only remaining red is the uv path — |
uv can't inspect the MinGW interpreter, so creating a uv venv from it fails (wntrblm#1088). Mark the affected uv/script-mode tests xfail on MinGW (non-strict, so they xpass once wntrblm#1117 lands) to keep the experimental MSYS2 job green. Assisted-by: ClaudeCode:claude-opus-4.8
* ci: skip uv install on MinGW in tests session uv ships no MinGW wheel and fails to build from source there; the uv tests already skip via @has_uv when the command is absent. Assisted-by: ClaudeCode:claude-opus-4.8 * ci: add experimental MSYS2/MinGW test run Runs the suite under a real MSYS2/MINGW64 Python to exercise the nox.virtualenv._IS_MINGW code paths, previously only covered by mocked unit tests. Non-blocking (continue-on-error) until proven stable; feeds coverage into the cover job. uv comes from setup-uv (no uv CLI exists in MSYS2 repos), and the session is forced onto the virtualenv backend so the interpreter under test stays MinGW. Assisted-by: ClaudeCode:claude-opus-4.8 * test: account for MinGW POSIX venv layout in bin-path tests On a real MSYS2/MinGW host sys.platform is win32 but the native venv uses a POSIX bin/ layout (with .exe executables), so the Windows-layout assertions must exclude MinGW. Exercised by the experimental MSYS2 CI job. Assisted-by: ClaudeCode:claude-opus-4.8 * test: xfail uv-backend tests under MinGW until #1117 uv can't inspect the MinGW interpreter, so creating a uv venv from it fails (#1088). Mark the affected uv/script-mode tests xfail on MinGW (non-strict, so they xpass once #1117 lands) to keep the experimental MSYS2 job green. Assisted-by: ClaudeCode:claude-opus-4.8 * ci: touch up comments on uv and msys Signed-off-by: Henry Schreiner <henryfs@princeton.edu> --------- Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
uv can't inspect the MSYS2/MinGW interpreter (it reports an unknown operating system like `mingw_x86_64_ucrt_gnu`), so passing `-p sys.executable` made `uv venv` fail in script mode. Skip `-p` on MinGW when no interpreter is requested and let uv pick the default, which works. uv also builds a Windows-style venv (`Scripts`/`python.exe`) even under MinGW, unlike the native interpreter and virtualenv/venv which use a POSIX layout. A new `_windows_layout` property captures this so `bin_paths` and the reuse check pick the right directory per backend. Assisted-by: ClaudeCode:claude-opus-4.8
82cef5a to
a165a5e
Compare
Okay, I think this is a valid fix for #1088. @Tiphereth-A, would be good if you could take a look to be sure. :)
🤖 AI text below 🤖
Fixes #1088.
Problem
Under MSYS2/MinGW,
uvcannot inspect the native interpreter — it reports an unknown operating system (e.g.mingw_x86_64_ucrt_gnu). Because script mode runsuv venv -p <sys.executable> ..., venv creation failed even though a bareuv venvworks fine.Fix
VirtualEnv.create, skip-pfor theuvbackend on MinGW when no interpreter is explicitly requested, letting uv pick the default (which works). An explicit interpreter is still passed through, and non-MinGW behavior is unchanged.Scripts/python.exe) even under MinGW, whereas the native interpreter and virtualenv/venv use a POSIX layout (bin/python). A new_windows_layoutproperty centralizes this sobin_pathsand the environment-reuse check select the right directory per backend.Based on the patch from @Tiphereth-A in msys2/MINGW-packages#28759.
Tests
Added tests for the MinGW uv layout, the MinGW no-
-pcommand, and the explicit-interpreter uv path.nox/virtualenv.pyandtests/test_virtualenv.pypass lint and the fulltest_virtualenv.pysuite.