Support both local installation and hermetic build for Python. #15
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.
Reasons for those changes
@python
repository: Python projects with C/C++ extensions/modules require corresponding cpython headers and libraries.Changes in
bazel_python.bzl
bazel_local_python
bazel_local_python
replaces the originalbazel_python
. Changes:python_version
andname='python'
arguments.@name
(@python
by default) and expose cpython headers, libraries (@python
or@python//:python
) and binaries (e.g.,@python//:bin/python3
).bazel_hermetic_python
The new
bazel_hermetic_python
fetches a python source code and builds it using@bazel_python//:external/python*.*.BUILD
. It has the same interface asbazel_local_python
and gives the build@python
repository.bazel_python_venv
bazel_python_venv
no longer takes thepython_version
argument. Instead, it takes an (implicit)python
(tool) argument to specify which Python repository and binary to use. It by default is@python//:bin/python3
.