Skip to content

Commit

Permalink
chore: use rules_python's py_runtime in generated toolchains
Browse files Browse the repository at this point in the history
This makes rules_python compatible with disabling using the native rules
in Bazel.

Work towards #1069
  • Loading branch information
rickeylev committed Dec 12, 2023
1 parent ee2cc93 commit 1a48a42
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions python/private/common/py_runtime_rule.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ interpreter.
# Example
```
load("@rules_python//python:py_runtime.bzl", "py_runtime")
py_runtime(
name = "python-2.7.12",
files = glob(["python-2.7.12/**"]),
Expand Down
3 changes: 2 additions & 1 deletion python/private/py_runtime_pair_rule.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ Example usage:
```python
# In your BUILD file...
load("@rules_python//python:defs.bzl", "py_runtime_pair")
load("@rules_python//python:py_runtime.bzl", "py_runtime")
load("@rules_python//python:py_runtime_pair.bzl", "py_runtime_pair")
py_runtime(
name = "my_py2_runtime",
Expand Down
3 changes: 2 additions & 1 deletion python/py_runtime_pair.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ def py_runtime_pair(name, py2_runtime = None, py3_runtime = None, **attrs):
```python
# In your BUILD file...
load("@rules_python//python:defs.bzl", "py_runtime_pair")
load("@rules_python//python:py_runtime.bzl", "py_runtime")
load("@rules_python//python:py_runtime_pair.bzl", "py_runtime_pair")
py_runtime(
name = "my_py3_runtime",
Expand Down
3 changes: 2 additions & 1 deletion python/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@ def _python_repository_impl(rctx):
build_content = """\
# Generated by python/repositories.bzl
load("@bazel_tools//tools/python:toolchain.bzl", "py_runtime_pair")
load("@rules_python//python:py_runtime.bzl", "py_runtime")
load("@rules_python//python:py_runtime_pair.bzl", "py_runtime_pair")
load("@rules_python//python/cc:py_cc_toolchain.bzl", "py_cc_toolchain")
package(default_visibility = ["//visibility:public"])
Expand Down

0 comments on commit 1a48a42

Please sign in to comment.