Install python.exe into Windows venvs for console scripts - #410
Draft
agriyakhetarpal wants to merge 1 commit into
Draft
Install python.exe into Windows venvs for console scripts#410agriyakhetarpal wants to merge 1 commit into
agriyakhetarpal wants to merge 1 commit into
Conversation
A Pyodide venv on Windows had no .exe interpreter: _create_python_symlink deleted every python*.exe virtualenv created and put .bat symlinks in their place. The launcher pip generates for a console script refuses to invoke anything that is not an .exe, so no installed script could run. Pyodide already ships a python.exe shim that forwards to python.bat, so copy that into the venv and point pip_wrapper.get_executable at it. Copy rather than symlink: the shim resolves its own path before looking for python.bat beside it, so a symlink would send it to the dist directory and lose the venv. The shim mangles paths holding a space until pyodide/pyodide#6381 is released, so the Windows venv test and the CI step that builds a venv outside the workspace both avoid one for now, with TODOs to restore them. This reapplies what the previous commit on the base branch reverted.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split off from #409. I have submitted this via
gh stack submit(i.e., the GitHub Stacked PRs preview that I applied to and we received). A Pyodide venv on Windows has not had our.exeinterpreter because_create_python_symlinkdeleted everypython*.exethatvirtualenvcreated and put.batsymlinks in their place. The launcher that pip generates for a console script refuses to invoke anything that is not an .exe, so no installed script could run.The idea here is that we already ship a
python.exeshim that forwards topython.bat, so we can now copy that into the venv and pointpip_wrapper.get_executableat it. It is a copy rather than a symlink because the shim resolves its own path before looking forpython.batbeside it, so a symlink would send it to the dist directory and lose the venv.The shim currently mangles any paths holding a space, for which I created pyodide/pyodide#6381 - it would be good to have that in Pyodide 314.0.4 release but it's not a blocker here because our Windows support is pretty much experimental anyway
Stack created with GitHub Stacks CLI • Give Feedback 💬