Skip to content

Commit 1b835c3

Browse files
committed
reshuffle the loads to make the tests compatible with WORKSPACE
1 parent ece6b68 commit 1b835c3

File tree

4 files changed

+17
-16
lines changed

4 files changed

+17
-16
lines changed

MODULE.bazel

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@ python.toolchain(
4646
is_default = True,
4747
python_version = "3.11",
4848
)
49-
use_repo(python, "python_3_11", "python_versions", "pythons_hub")
49+
use_repo(
50+
python,
51+
"python_3_11",
52+
"pythons_hub",
53+
python = "python_versions",
54+
)
5055

5156
# This call registers the Python toolchains.
5257
register_toolchains("@pythons_hub//:all")

WORKSPACE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ load("//:internal_dev_setup.bzl", "rules_python_internal_setup")
6868

6969
rules_python_internal_setup()
7070

71-
load("@pythons_hub//:versions.bzl", "MINOR_MAPPING", "PYTHON_VERSIONS")
71+
load("@pythons_hub//:versions.bzl", "PYTHON_VERSIONS")
7272
load("//python:repositories.bzl", "python_register_multi_toolchains")
7373

7474
python_register_multi_toolchains(
7575
name = "python",
76-
default_version = MINOR_MAPPING.values()[-3], # Use 3.11.10
76+
default_version = "3.11",
7777
# Integration tests verify each version, so register all of them.
7878
python_versions = PYTHON_VERSIONS,
7979
)

tests/deprecated/BUILD.bazel

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
load("@bazel_skylib//rules:build_test.bzl", "build_test")
2+
load(
3+
"@python//3.11:defs.bzl",
4+
hub_compile_pip_requirements = "compile_pip_requirements",
5+
hub_py_binary = "py_binary",
6+
hub_py_console_script_binary = "py_console_script_binary",
7+
hub_py_test = "py_test",
8+
)
29
load(
310
"@python_3_11//:defs.bzl",
411
versioned_compile_pip_requirements = "compile_pip_requirements",
512
versioned_py_binary = "py_binary",
613
versioned_py_console_script_binary = "py_console_script_binary",
714
versioned_py_test = "py_test",
815
)
9-
load(
10-
"@python_versions//3.11:defs.bzl",
11-
hub_compile_pip_requirements = "compile_pip_requirements",
12-
hub_py_binary = "py_binary",
13-
hub_py_console_script_binary = "py_console_script_binary",
14-
hub_py_test = "py_test",
15-
)
1616
load("//python/config_settings:transition.bzl", transition_py_binary = "py_binary", transition_py_test = "py_test")
1717

1818
# TODO @aignas 2025-01-22: remove the referenced symbols when releasing v2

tools/publish/BUILD.bazel

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
load("//python:py_binary.bzl", "py_binary")
21
load("//python/entry_points:py_console_script_binary.bzl", "py_console_script_binary")
32
load("//tools/private:publish_deps.bzl", "publish_deps")
43

54
py_console_script_binary(
65
name = "twine",
7-
# We use a py_binary rule with version transitions to ensure that we do not
8-
# rely on the default version of the registered python toolchain. What is more
9-
# we are using this instead of `@python_versions//3.11:defs.bzl` because loading
10-
# that file relies on bzlmod being enabled.
11-
binary_rule = py_binary,
6+
# We transition to a specific python version in order to ensure that we
7+
# don't rely on the default version configured by the root module.
128
pkg = "@rules_python_publish_deps//twine",
139
python_version = "3.11",
1410
script = "twine",

0 commit comments

Comments
 (0)