-
Notifications
You must be signed in to change notification settings - Fork 434
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
Pass real paths when running subprocesses #1168
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems harmless enough.
I looked at the test failure and it turns out that my PR in its current state breaks every OS except Windows 😅 One thing I did not realize is that, on every OS except Windows, the This is a bit of a catch-22: on Windows using MS Store Python, I'll see if I can come up with a fix that doesn't assume too much about the particular implementation details of venvs on each platform. |
Okay I managed to make it work on every OS by only using the real path if the executable is not a symlink. The basic idea is that if the target is a symlink then the target might care about |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test please and changelog entry.
These code paths are already covered, and both branches are taken in GitHub Actions workflows (the non-symlink branch is taken on Windows, and the symlink branch is taken on every other OS). If you want me to add a regression test for #1164, well, I tried to do that, but sadly it's not as easy as it seems because I was unable to get MS Store Python to install in a GitHub Actions Windows runner (see Cyberboss/install-winget#1 for one approach I tried).
Done. |
This gets rid of the following warning when using the Microsoft Store version of Python: The system cannot find the path specified. Failed to delete C:\Users\etien\AppData\Local\pipx\pipx\trash. You may need to delete it manually. See also pypa#1164
This code dates all the way back to 7cb6561. It's not clear why this code decides to spawn an rmdir process on Windows instead of simply calling `shutil.rmtree()` directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This reverts commit 9e62270. The pipx issue was fixed in pypa/pipx#1168 and the fix made it into pipx 1.4.0.
by moving the whole os.path.realpath logic introduced in pypa#1168 to pipx.util:get_venv_paths
by moving the whole os.path.realpath logic introduced in pypa#1168 to pipx.util:get_venv_paths
by moving the whole os.path.realpath logic introduced in pypa#1168 to pipx.util:get_venv_paths
…ws (#1232) * Fix path resolution for python executables looked up in PATH on windows by moving the whole os.path.realpath logic introduced in #1168 to pipx.util:get_venv_paths * Fix failing tests by deleting no longer relevant tests --------- Co-authored-by: guahki <[email protected]> Co-authored-by: Robert <[email protected]>
Summary of changes
Fixes #1164 by making sure real paths are passed to executables that are not subject to path redirection.
Test plan
The above fails without this PR with the error shown in #1164, but succeeds with this PR.
I tried to add a GitHub Actions job that does the above so that any future regressions will be caught, but unfortunately installing Microsoft Store apps in a GitHub Actions workflow does not appear to be easy (see e.g. Cyberboss/install-winget#1).