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
@pythonrepository: Python projects with C/C++ extensions/modules require corresponding cpython headers and libraries.Changes in
bazel_python.bzlbazel_local_pythonbazel_local_pythonreplaces the originalbazel_python. Changes:python_versionandname='python'arguments.@name(@pythonby default) and expose cpython headers, libraries (@pythonor@python//:python) and binaries (e.g.,@python//:bin/python3).bazel_hermetic_pythonThe new
bazel_hermetic_pythonfetches a python source code and builds it using@bazel_python//:external/python*.*.BUILD. It has the same interface asbazel_local_pythonand gives the build@pythonrepository.bazel_python_venvbazel_python_venvno longer takes thepython_versionargument. Instead, it takes an (implicit)python(tool) argument to specify which Python repository and binary to use. It by default is@python//:bin/python3.