-
Notifications
You must be signed in to change notification settings - Fork 4.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
Specify 2.7 instead of 2 for python version #9402
Conversation
This changes the python setup to prefer an executable named `python2.7` over `python2`. This fixes an issue on macOS where it doesn't ship with a `python2` executable, but you can install one from homebrew, but really you'd prefer to be using the system `python2.7` binary. I assume that this isn't a huge issue because bazel likely doesn't support versions of python before 2.7.
cc @brandjon (we also discussed this in slack), this is meant to fix this issue #8536 (comment) |
Another option in our case is to stop passing |
Any thoughts on something like this @brandjon ? |
Hi Keith, This change makes it so the autodetecting toolchain's PY2 runtime would 1) look for the command To get precise control over what interpreter is picked, I'd use an explicit Python toolchain instead of relying on the default autodetecting one. |
The core issue I'm trying to fix here is that |
Is there any harm in looking for the OS X system-installed |
Ping @brandjon |
ping @brandjon |
I assume at this point this won't matter for much longer because python 2 support will be removed? |
We're not removing support for building and running Python 2 code using Bazel. We've only removed the expectation that Bazel itself (and some language-specific tooling) will work with Python 2. The issue with this PR is that it is a backwards-incompatible change that solves the problem in an ad hoc way, by changing the default for everyone, to accommodate a situation that is particular to a given environment and IMO better addressed by choosing an explicit toolchain. (That said, there is some precedent for tweaking the Python interpreter location based on platform in #10432, although that case was for the stub script shebang, and would be eliminated by a future improvement to allow toolchains to specify the shebang string.) |
Given the last comments, I'm assuming this PR is dead on arrival. |
FWIW this is still an issue. I haven't heard an alternative path to fixing this but we might want to. I assume with the current state of python2 at this point folks are feeling super motivated to support this though. |
This changes the python setup to prefer an executable named
python2.7
over
python2
. This fixes an issue on macOS where it doesn't ship witha
python2
executable, but you can install one from homebrew, butreally you'd prefer to be using the system
python2.7
binary. I assumethat this isn't a huge issue because bazel likely doesn't support
versions of python before 2.7.
Follow up to 3a4be3c