python_stub_template.txt's use of env python
ignores py_toolchain
config
#10043
Labels
team-Rules-Python
Native rules for Python
Description of the problem / feature request:
On a machine without
python
where we want to setup a python toolchain that points topython2.7
, it looks like thispython_stub_template.txt
does not respect the toolchain and instead hardcodes the use ofenv python
when doing abazel run //some:py_binary
and eventually causes an error:/usr/bin/env: 'python': No such file or directory
I found
python_stub_template.txt
through looking through the output ofbazel build //some:py_binary
and searching for a comment that stood out to me as reasonable unique: "Return True if running on Windows"Feature requests: what underlying problem are you trying to solve with this feature?
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
I'm not able to verify that this is a minimal example or that it fully reproduces the issue because my development and test systems are different.
bazel run //some:py_binary
//BUILD.bazel
//WORKSPACE
//some/BUILD
//some/py_binary.py
What operating system are you running Bazel on?
Ubuntu 18.04.3 LTS
What's the output of
bazel info release
?release 1.0.0
If
bazel info release
returns "development version" or "(@non-git)", tell us how you built Bazel.N/A
What's the output of
git remote get-url origin ; git rev-parse master ; git rev-parse HEAD
?git@github.com:lyft/instant-android.git
5ed105a471629bdbc4ce06be7e66908bd845ff4a
0dacf5733ef8d60c4f62a12d1127eece334092a2
Have you found anything relevant by searching the web?
Yes. There was a bug suggesting the use of
--python_top
and apy_runtime
target. However, on v1.0.0--python_top
is deprecated and I had already been using the true solution which was to make atoolchain
.#7899
States to use
toolchain_type = "@bazel_tools//tools/python:toolchain_type"
rather than the@rules_python//python:toolchain_type
that https://github.com/bazelbuild/bazel/blob/1.0.0/tools/python/toolchain.bzl#L104 suggests. I use rules_python because that seems to be the most-recent instruction.Any other information, logs, or outputs that you want to share?
No.
The text was updated successfully, but these errors were encountered: