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.
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.