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

fix(pip3): prefer python when available #471

Merged
merged 2 commits into from
Jun 23, 2023
Merged

Conversation

SteveLauC
Copy link
Member

Standards checklist:

  • The PR title is descriptive.
  • I have read CONTRIBUTING.md
  • The code compiles (cargo build)
  • The code passes rustfmt (cargo fmt)
  • The code passes clippy (cargo clippy)
  • The code passes tests (cargo test)
  • Optional: I have tested the code myself
    • I also tested that Topgrade skips the step where needed

If you developed a feature or a bug fix for someone else and you do not have the
means to test it, please tag this person here.


Closes #470, cc @soredake

Issue

On Windows, when you install python through winget, an actual python binary will be installed as well as a python3 shim, the shim is executable but will launch the Microsoft App store instead of a Python shell. Before this PR, topgrade called python3 under the hood, which is a shim under this case.

Solution

We check both python and python3 through .and_then(check_is_python_2_or_shim), if python is available and is a valid Python 3, we prefer to use it. This is fine as on most systems, python is a link to the default python3.

@soredake
Copy link

I will test this if there is a build of topgrade from this pr.

@SteveLauC
Copy link
Member Author

SteveLauC commented Jun 14, 2023

I will test this if there is a build of topgrade from this pr.

Will set up a rust dev environment on my Win VM and upload a build in my fork repo: https://github.com/SteveLauC/topgrade

@SteveLauC
Copy link
Member Author

I will test this if there is a build of topgrade from this pr.

Will set up a rust dev environment on my Win VM and upload a build in my folk repo: https://github.com/SteveLauC/topgrade

There you go: https://github.com/SteveLauC/topgrade/releases/tag/fix-pip3

@soredake
Copy link

Works fine now, thanks!

image

@s34m s34m merged commit 57546a0 into topgrade-rs:master Jun 23, 2023
@SteveLauC SteveLauC deleted the py-shim branch June 23, 2023 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Topgrade uses python3 shim instead of real python binary on windows
3 participants