Make python interpreter configurable to support python3 #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add pip_version_proxy to simplify picking correct pip deps
The new pip_version_proxy rule generates a requirements.bzl file that provides
a requirements() function that resolves to the correct version
of python dependencies depending on the current python runtime.
This is used via the WORKSPACE pattern:
With this code, requirement("foo") would map to @pip_deps2 when running
"bazel build --define python=py2", and to @pip_deps3 when running with
"bazel build --define python=py3".
Make python interpreter configurable
We need to propagate the python interpreter through all pip_import
and wheel rules, to support using two different interpreters
(read: python2 and python3) in the same workspace.
Check that python headers are installed
Lack of python headers (/usr/include/pythonX/...) on the host machine
may affect how wheels are built, which in turn can change the filenames
of the wheels. For example, "pip wheel wrapt==1.10.11" produces
"wrapt-1.10.11-py3-none-any.whl" if headers are not available, and
"wrapt-1.10.11-cp35-cp35m-linux_x86_64.whl" if they are. Since we
bake the wheel name into the locked requirements.bzl file, the build
would break depending on header availability.
Fix BUILD file generation for dirty wheels
When extracting foo_dirty wheel repository, we pass all wheels as an
argument to piptool that transitively depend on foo, so that piptool
will extract all of them to the foo_dirty repository. After that,
piptool generates a BUILD file from the first wheel, expecting
that to be foo.whl. This was not happening, since we were passing
wheels in random order to piptool extract.
Generate missing init.py files when extracting wheels
This allows us to stop relying on legacy_create_init=True attribute.