Make whltool python version configurable #216
Closed
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.
As part of the
whl_library
rule, we run a python script (packaged here aswhltool.par
) to generatepy_library
instances for each wheel. One of the functions of running that script is to parse the wheels' declared dependencies. In some cases, the sets of dependencies may vary depending on what python version is being used, even for a wheel file that is compatible with both python 2 and 3. This pull request adds an argument to thewhl_library
rule allowing the user to specify the desired version of python to run thewhltool
script - in my case, I pass the valuepython3
. It defaults to the original behavior of just runningpython
by itself.To give a concrete example of where this can come up, the
cryptography
package relies on a backported package when used under python<3.4, but does not require that backport for newer python versions: https://github.com/pyca/cryptography/blob/master/setup.py#L239-L240 . When attempting to install this library with python 3.7, it's not possible to find that backported library, and so we can't resolve the dependencies.I'm very open to renaming things here if desired, or to (say) attempt to resolve the path to the python interpreter using something like https://docs.bazel.build/versions/master/skylark/lib/repository_ctx.html#which. I elected to use
python_target
so that the user would understand that this should correspond to the target python version that will eventually run whatever code relies on thewhl_library
.