Skip to content

Commit f028ccc

Browse files
committed
fix sha key, add some doc, remove unneeded use_repo
1 parent a93fcaf commit f028ccc

File tree

3 files changed

+35
-4
lines changed

3 files changed

+35
-4
lines changed

tests/integration/local_toolchains/MODULE.bazel

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ local_path_override(
2323
path = "../../..",
2424
)
2525

26+
# Step 1: Define the python runtime
2627
local_runtime_repo = use_repo_rule("@rules_python//python/local_toolchains:repos.bzl", "local_runtime_repo")
2728

2829
local_runtime_toolchains_repo = use_repo_rule("@rules_python//python/local_toolchains:repos.bzl", "local_runtime_toolchains_repo")
2930

31+
# This will use `python3` from the environment
3032
local_runtime_repo(
3133
name = "local_python3",
3234
interpreter_path = "python3",
@@ -43,18 +45,24 @@ pbs_archive(
4345
"mac osx": "4fb42ffc8aad2a42ca7646715b8926bc6b2e0d31f13d2fec25943dc236a6fd60",
4446
},
4547
urls = {
46-
"windows": "https://github.com/astral-sh/python-build-standalone/releases/download/20250918/cpython-3.13.7+20250918-x86_64-pc-windows-msvc-install_only.tar.gz",
48+
"windows server 2022": "https://github.com/astral-sh/python-build-standalone/releases/download/20250918/cpython-3.13.7+20250918-x86_64-pc-windows-msvc-install_only.tar.gz",
4749
"linux": "https://github.com/astral-sh/python-build-standalone/releases/download/20250918/cpython-3.13.7+20250918-x86_64-unknown-linux-gnu-install_only.tar.gz",
48-
"mac os x": "https://github.com/astral-sh/python-build-standalone/releases/download/20250918/cpython-3.13.7+20250918-x86_64-apple-darwin-install_only.tar.gz",
50+
"mac osx": "https://github.com/astral-sh/python-build-standalone/releases/download/20250918/cpython-3.13.7+20250918-x86_64-apple-darwin-install_only.tar.gz",
4951
},
5052
)
5153

54+
# This will use Python from the `pbs_runtime` repository.
55+
# The pbs_runtime is just an example; the repo just needs to be a valid Python
56+
# installation.
5257
local_runtime_repo(
5358
name = "repo_python3",
5459
interpreter_target = "@pbs_runtime//:python/bin/python3",
5560
on_failure = "fail",
5661
)
5762

63+
# Step 2: Create toolchains for the runtimes
64+
# Below, we configure them to only activate if the `//:py` flag has particular
65+
# values.
5866
local_runtime_toolchains_repo(
5967
name = "local_toolchains",
6068
runtimes = [
@@ -84,6 +92,7 @@ config.add_transition_setting(setting = "//:py")
8492

8593
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
8694
python.toolchain(python_version = "3.13")
87-
use_repo(python, "python_3_13_host", "rules_python_bzlmod_debug")
95+
use_repo(python, "rules_python_bzlmod_debug")
8896

97+
# Step 3: Register the toolchains
8998
register_toolchains("@local_toolchains//:all")

tests/integration/local_toolchains/WORKSPACE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,28 @@ local_runtime_repo(
2121
# or interpreter_path = "C:\\path\\to\\python.exe"
2222
)
2323

24+
load("//:pbs_archive.bzl", "pbs_archive")
25+
26+
pbs_archive(
27+
name = "pbs_runtime",
28+
sha256 = {
29+
"windows": "005cb2abf4cfa4aaa48fb10ce4e33fe4335ea4d1f55202dbe4e20c852e45e0f9",
30+
"linux": "0a01bad99fd4a165a11335c29eb43015dfdb8bd5ba8e305538ebb54f3bf3146d",
31+
"mac osx": "4fb42ffc8aad2a42ca7646715b8926bc6b2e0d31f13d2fec25943dc236a6fd60",
32+
},
33+
urls = {
34+
"windows server 2022": "https://github.com/astral-sh/python-build-standalone/releases/download/20250918/cpython-3.13.7+20250918-x86_64-pc-windows-msvc-install_only.tar.gz",
35+
"linux": "https://github.com/astral-sh/python-build-standalone/releases/download/20250918/cpython-3.13.7+20250918-x86_64-unknown-linux-gnu-install_only.tar.gz",
36+
"mac osx": "https://github.com/astral-sh/python-build-standalone/releases/download/20250918/cpython-3.13.7+20250918-x86_64-apple-darwin-install_only.tar.gz",
37+
},
38+
)
39+
40+
local_runtime_repo(
41+
name = "repo_python3",
42+
interpreter_target = "@pbs_runtime//:python/bin/python3",
43+
on_failure = "fail",
44+
)
45+
2446
# Step 2: Create toolchains for the runtimes
2547
local_runtime_toolchains_repo(
2648
name = "local_toolchains",

tests/integration/local_toolchains/pbs_archive.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def _pbs_archive_impl(repository_ctx):
2525
))
2626

2727
url = urls[os_name]
28-
sha256 = sha256s.get(os_name)
28+
sha256 = sha256s.get(os_name, "")
2929

3030
repository_ctx.download_and_extract(
3131
url = url,

0 commit comments

Comments
 (0)