-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Choose the version of python at runtime (portable version) #80625
Conversation
b31222c
to
9725665
Compare
On Windows, the conventional way to run different python versions is with the Edit: In case anyone wants, here's how pytype finds an executable for a platform: link |
Ok, this now tries to be smart about the hashbang again. @nagisa I tested in fish this time and it works, but always happy to get more testing :) This shouldn't affect windows at all since people seem to be using |
@CraftSpider is there more to the error below? |
That's the whole error in both cases. And I agree, I think the issue is just that the path doesn't exist. I can probably even test that if you want, by adding a program at |
155dd5a
to
9725665
Compare
So it turns out that
Doing anything else gives an error that /usr/bin/env doesn't exist. Removing the shebang breaks |
Looks reasonable to me. |
x.py
Outdated
# interpreter. | ||
if sys.version_info.major < 3: | ||
try: | ||
os.execvp("python3", ["python3"] + sys.argv) |
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.
Can we try to use the alternate forms (e.g., I take it Windows would prefer something like py --version 3 ...
perhaps?
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.
I don't know how useful that would be, since download-ci-llvm
currently only works on linux. I can add it just in case #77084 ever gets fixed if you like.
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.
Also, I'm not able to test on windows, so I'm a little hesitant to add code that I haven't tried.
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.
Thanks!
r=me with commits squashed |
- Try `py -3` first for windows compatibility - Fall back to `python3` if `py` doesn't work
146c841
to
c8cac2a
Compare
@bors r=Mark-Simulacrum |
📌 Commit c8cac2a has been approved by |
☀️ Test successful - checks-actions |
r? @Mark-Simulacrum
Fixed version of #80585. The goal is to avoid giving 'error: python3 required' when downloading LLVM from CI and instead default to python3 where possible.
This has some minor overhead when you have
python
as python2, but almost nothing compared to actually running the build.