Skip to content

Commit 9b8f650

Browse files
aignasrickeylev
andauthored
fix: support pre-release versions and add new toolchain versions (bazel-contrib#2969)
Add latest toolchain builds and attempt adding a beta build. This shows/tests that we can handle pre-release versions just fine and we are able to test the toolchain matching. Whilst at it it implements the static advertising of the remaining interpreter information. Fixes bazel-contrib#2837 --------- Co-authored-by: Richard Levasseur <richardlev@gmail.com>
1 parent ef14ae2 commit 9b8f650

File tree

7 files changed

+209
-35
lines changed

7 files changed

+209
-35
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ END_UNRELEASED_TEMPLATE
5555
{#1-5-0-changed}
5656
### Changed
5757

58+
* (toolchain) Bundled toolchain version updates:
59+
* 3.9 now references 3.9.23
60+
* 3.10 now references 3.10.18
61+
* 3.11 now references 3.11.13
62+
* 3.12 now references 3.12.11
63+
* 3.13 now references 3.13.4
5864
* (rules) On Windows, {obj}`--bootstrap_impl=system_python` is forced. This
5965
allows setting `--bootstrap_impl=script` in bazelrc for mixed-platform
6066
environments.
@@ -92,6 +98,8 @@ END_UNRELEASED_TEMPLATE
9298
* (pypi) Correctly aggregate the sources when the hashes specified in the lockfile differ
9399
by platform even though the same version is used. Fixes [#2648](https://github.com/bazel-contrib/rules_python/issues/2648).
94100
* (pypi) `compile_pip_requirements` test rule works behind the proxy
101+
* (toolchains) The hermetic toolchains now correctly statically advertise the
102+
`releaselevel` and `serial` for pre-release hermetic toolchains ({gh-issue}`2837`).
95103

96104
{#1-5-0-added}
97105
### Added
@@ -114,6 +122,7 @@ END_UNRELEASED_TEMPLATE
114122
* (rules) Added support for a using constraints files with `compile_pip_requirements`.
115123
Useful when an intermediate dependency needs to be upgraded to pull in
116124
security patches.
125+
* (toolchains): 3.14.0b2 has been added as a preview.
117126

118127
{#1-5-0-removed}
119128
### Removed

python/private/hermetic_runtime_repo_setup.bzl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,14 @@ def define_hermetic_runtime_toolchain_impl(
195195
values = {"collect_code_coverage": "true"},
196196
visibility = ["//visibility:private"],
197197
)
198+
if not version_info.pre:
199+
releaselevel = "final"
200+
else:
201+
releaselevel = {
202+
"a": "alpha",
203+
"b": "beta",
204+
"rc": "candidate",
205+
}.get(version_info.pre[0])
198206

199207
py_runtime(
200208
name = "py3_runtime",
@@ -204,6 +212,8 @@ def define_hermetic_runtime_toolchain_impl(
204212
"major": str(version_info.release[0]),
205213
"micro": str(version_info.release[2]),
206214
"minor": str(version_info.release[1]),
215+
"releaselevel": releaselevel,
216+
"serial": str(version_info.pre[1]) if version_info.pre else "0",
207217
},
208218
coverage_tool = select({
209219
# Convert empty string to None

python/versions.bzl

Lines changed: 144 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,21 @@ TOOL_VERSIONS = {
186186
},
187187
"strip_prefix": "python",
188188
},
189+
"3.9.23": {
190+
"url": "20250610/cpython-{python_version}+20250610-{platform}-{build}.tar.gz",
191+
"sha256": {
192+
"aarch64-apple-darwin": "f1a60528b6088ee8b8a34ca0e960998f4f664bed300ec0bbfe9d66ccbda74e50",
193+
"aarch64-unknown-linux-gnu": "2871cf240bce3c021de829d73da04026febd7a775d1a1a1b37603ec6419fb6c1",
194+
"ppc64le-unknown-linux-gnu": "2ba44a8e084a4661dbe50c0f0e3cf0a57227c6f1cff13fc2ae2f4d8ceae699fc",
195+
"riscv64-unknown-linux-gnu": "7a735aebfc8b19a8af1f03e28babaf18a46cf8db0a931343dac1269376a1f693",
196+
"s390x-unknown-linux-gnu": "27cfc030f782e2683c664e41dcef36051467c98676e133cbef04d4b7155ac4aa",
197+
"x86_64-apple-darwin": "debd576badb6fdabb793ec9956512102f5a813c837449b1fe007c0af977db36c",
198+
"x86_64-pc-windows-msvc": "28fbf2026929e00a300466220917c7029a69331700badb34b1691f1a99aa38e3",
199+
"x86_64-unknown-linux-gnu": "21440e51aee78f3d92faf9375a90713542d8332e83d94c284f8f3d52c58eb5ca",
200+
"x86_64-unknown-linux-musl": "7a881405a41cb4edf8c0d7c469c2f4759f601bc6f3c47978424a1ab1d0f1fada",
201+
},
202+
"strip_prefix": "python",
203+
},
189204
"3.10.2": {
190205
"url": "20220227/cpython-{python_version}+20220227-{platform}-{build}.tar.gz",
191206
"sha256": {
@@ -321,6 +336,21 @@ TOOL_VERSIONS = {
321336
},
322337
"strip_prefix": "python",
323338
},
339+
"3.10.18": {
340+
"url": "20250610/cpython-{python_version}+20250610-{platform}-{build}.tar.gz",
341+
"sha256": {
342+
"aarch64-apple-darwin": "a6590f71f670c7d121ac4f068dc83e271cf03309b80b1fa5890ee4875b7b691d",
343+
"aarch64-unknown-linux-gnu": "b4d7cfb2cb5163da1ae5955ae8b33ac0b356780483d2993099899cf59efaea70",
344+
"ppc64le-unknown-linux-gnu": "36aeae5cc61ff07c78b061f1b6aac628998a380ad45fadc82b8764185544fd7f",
345+
"riscv64-unknown-linux-gnu": "2f6dd270598b655db5da5d98d1c43e560f6fb46c67a8fd68ff9b11ee9f6d79ff",
346+
"s390x-unknown-linux-gnu": "616e56fe69c97a1d0ff13c00f337b2a91c972323c5d9a1828fdfc4d764b440fa",
347+
"x86_64-apple-darwin": "4d72c1c1dcd2c4fe80055ef1b24fe4146f2de938aea1e3676faf91476f3f17e8",
348+
"x86_64-pc-windows-msvc": "867b6dbcdb71d8ebb709ff54fbca8ad43d05cc21e5c157f39745c4dc44c1f8e2",
349+
"x86_64-unknown-linux-gnu": "58f88ed6117078fdbc98976c9bc83b918f1f9c0c2ec21b80a582104f4839861c",
350+
"x86_64-unknown-linux-musl": "d782c0569d6d7e21a5ed195ad7b41d0af8456b031e0814714d18cdeaa876f262",
351+
},
352+
"strip_prefix": "python",
353+
},
324354
"3.11.1": {
325355
"url": "20230116/cpython-{python_version}+20230116-{platform}-{build}.tar.gz",
326356
"sha256": {
@@ -436,18 +466,18 @@ TOOL_VERSIONS = {
436466
},
437467
"strip_prefix": "python",
438468
},
439-
"3.11.11": {
440-
"url": "20250317/cpython-{python_version}+20250317-{platform}-{build}.tar.gz",
469+
"3.11.13": {
470+
"url": "20250610/cpython-{python_version}+20250610-{platform}-{build}.tar.gz",
441471
"sha256": {
442-
"aarch64-apple-darwin": "19b147c7e4b742656da4cb6ba35bc3ea2f15aa5f4d1bbbc38d09e2e85551e927",
443-
"aarch64-unknown-linux-gnu": "7d52b5206afe617de2899af477f5a1d275ecbce80fb8300301b254ebf1da5a90",
444-
"ppc64le-unknown-linux-gnu": "17c049f70ce719adc89dd0ae26f4e6a28f6aaedc63c2efef6bbb9c112ea4d692",
445-
"riscv64-unknown-linux-gnu": "83ed50713409576756f5708e8f0549a15c17071bea22b71f15e11a7084f09481",
446-
"s390x-unknown-linux-gnu": "298507f1f8d962b1bb98cb506c99e7e0d291a63eb9117e1521141e6b3825fd56",
447-
"x86_64-apple-darwin": "a870cd965e7dded5100d13b1d34cab1c32a92811e000d10fbfe9bbdb36cdaa0e",
448-
"x86_64-pc-windows-msvc": "1cf5760eea0a9df3308ca2c4111b5cc18fd638b2a912dbe07606193e3f9aa123",
449-
"x86_64-unknown-linux-gnu": "51e47bc0d1b9f4bf68dd395f7a39f60c58a87cde854cab47264a859eb666bb69",
450-
"x86_64-unknown-linux-musl": "ee4d84f992c6a1df42096e26b970fe5938fd6c1eadd245894bc94c5737ff9977",
472+
"aarch64-apple-darwin": "365037494ba4f53563c22292e49a8e4d0d495bcb6534fca9666bdd1b474abf36",
473+
"aarch64-unknown-linux-gnu": "a5954f147e87d9bff3d9733ebb3e74fe997eec5b38eaf5cb4429038228962a16",
474+
"ppc64le-unknown-linux-gnu": "9214126866418f290fda88832fa3e244630f918ebc8a4a9ee15ba922e9c98afd",
475+
"riscv64-unknown-linux-gnu": "fd99008c3123f50ec2ad407c5c1e17c1a86590daaf88dae8e6f1fd28f099b7c2",
476+
"s390x-unknown-linux-gnu": "e27ab1fff8bf9e507677252a03ed524c685a8629b56475e26ab6dd0f88465179",
477+
"x86_64-apple-darwin": "b49044115a545e67d73f5265a613a25da7c9523431281aa7b94691f1013355af",
478+
"x86_64-pc-windows-msvc": "c0f89e3776211147817d54084fa046e2603571e18ff2ae4a4a8ff84ca4f7defc",
479+
"x86_64-unknown-linux-gnu": "d93a7699505ee0ac7dec0f09324ffb19a31cce3066a287bb1fe95285ce3ea0c7",
480+
"x86_64-unknown-linux-musl": "499121bb917e5baeeb954f76bdbce36bb63af579ff1530966ae2280e8d812c5b",
451481
},
452482
"strip_prefix": "python",
453483
},
@@ -559,6 +589,21 @@ TOOL_VERSIONS = {
559589
},
560590
"strip_prefix": "python",
561591
},
592+
"3.12.11": {
593+
"url": "20250610/cpython-{python_version}+20250610-{platform}-{build}.tar.gz",
594+
"sha256": {
595+
"aarch64-apple-darwin": "9c5826a93ddc15e8aa08de1e6e65b3ae0d45ea8eb0c2e9547b80ff4121b870ce",
596+
"aarch64-unknown-linux-gnu": "eb33bc5a87443daf2fd218109df811bc4e4ea5ef9aec4fad75aa55da0258b96f",
597+
"ppc64le-unknown-linux-gnu": "7b90bc528c5ddf30579dec52926d68fa6d5c90b65e24fc185d5fe283fdf0cbd9",
598+
"riscv64-unknown-linux-gnu": "0f3103675102e351762a8fe574eae20335552a246a45a006d2a9ca14ce0952f8",
599+
"s390x-unknown-linux-gnu": "a7ff0432208450ccebd5d328f69b84cc7c25b4af54fbab44803ddb11a2da5028",
600+
"x86_64-apple-darwin": "199631baa35f3747ddfa2f1e28fc062b97ccd15b94a60c9294d4d129a73c9e53",
601+
"x86_64-pc-windows-msvc": "e05fa165841c416d60365ca2216cad570f05ae5d3d027b9ad3beaad0529dd8cc",
602+
"x86_64-unknown-linux-gnu": "77ab3efe5c6637fe8da0fdfbff5de1730c3b824874fe1368917886908b4c517b",
603+
"x86_64-unknown-linux-musl": "9dd768494c4a34abcec316bc4802e957db98ed283024b527c0c40dfefd08b6fe",
604+
},
605+
"strip_prefix": "python",
606+
},
562607
"3.13.0": {
563608
"url": "20241016/cpython-{python_version}+20241016-{platform}-{build}.{ext}",
564609
"sha256": {
@@ -674,16 +719,99 @@ TOOL_VERSIONS = {
674719
"x86_64-unknown-linux-gnu-freethreaded": "python/install",
675720
},
676721
},
722+
"3.13.4": {
723+
"url": "20250610/cpython-{python_version}+20250610-{platform}-{build}.{ext}",
724+
"sha256": {
725+
"aarch64-apple-darwin": "c2ce6601b2668c7bd1f799986af5ddfbff36e88795741864aba6e578cb02ed7f",
726+
"aarch64-unknown-linux-gnu": "3c2596ece08ffe17e11bc1f27aeb4ce1195d2490a83d695d36ef4933d5c5ca53",
727+
"ppc64le-unknown-linux-gnu": "b3cc13ee177b8db1d3e9b2eac413484e3c6a356f97d91dc59de8d3fd8cf79d6b",
728+
"riscv64-unknown-linux-gnu": "d1b989e57a9ce29f6c945eeffe0e9750c222fdd09e99d2f8d6b0d8532a523053",
729+
"s390x-unknown-linux-gnu": "d1d19fb01961ac6476712fdd6c5031f74c83666f6f11aa066207e9a158f7e3d8",
730+
"x86_64-apple-darwin": "79feb6ca68f3921d07af52d9db06cf134e6f36916941ea850ab0bc20f5ff638b",
731+
"x86_64-pc-windows-msvc": "29ac3585cc2dcfd79e3fe380c272d00e9d34351fc456e149403c86d3fea34057",
732+
"x86_64-unknown-linux-gnu": "44e5477333ebca298a7a0a316985c6c3533b8645f92a83f7f73c44033832bf32",
733+
"x86_64-unknown-linux-musl": "a3afbfa94b9ff4d9fc426b47eb3c8446cada535075b8d51b7bdc9d9ab9911fc2",
734+
"aarch64-apple-darwin-freethreaded": "278dccade56b4bbeecb9a613b77012cf5c1433a5e9b8ef99230d5e61f31d9e02",
735+
"aarch64-unknown-linux-gnu-freethreaded": "b1c1bd6ab9ef95b464d92a6a911cef1a8d9f0b0f6a192f694ef18ed15d882edf",
736+
"ppc64le-unknown-linux-gnu-freethreaded": "ed66ae213a62b286b9b7338b816ccd2815f5248b7a28a185dc8159fe004149ae",
737+
"riscv64-unknown-linux-gnu-freethreaded": "913264545215236660e4178bc3e5b57a20a444a8deb5c11680c95afc960b4016",
738+
"s390x-unknown-linux-gnu-freethreaded": "7556a38ab5e507c1ec22bc38f9859982bc956cab7f4de05a2faac114feb306db",
739+
"x86_64-apple-darwin-freethreaded": "64ab7ac8c88002d9ba20a92f72945bfa350268e944a7922500af75d20330574d",
740+
"x86_64-pc-windows-msvc-freethreaded": "9457504547edb2e0156bf76b53c7e4941c7f61c0eff9fd5f4d816d3df51c58e3",
741+
"x86_64-unknown-linux-gnu-freethreaded": "864df6e6819e8f8e855ce30f34410fdc5867d0616e904daeb9a40e5806e970d7",
742+
},
743+
"strip_prefix": {
744+
"aarch64-apple-darwin": "python",
745+
"aarch64-unknown-linux-gnu": "python",
746+
"ppc64le-unknown-linux-gnu": "python",
747+
"s390x-unknown-linux-gnu": "python",
748+
"riscv64-unknown-linux-gnu": "python",
749+
"x86_64-apple-darwin": "python",
750+
"x86_64-pc-windows-msvc": "python",
751+
"x86_64-unknown-linux-gnu": "python",
752+
"x86_64-unknown-linux-musl": "python",
753+
"aarch64-apple-darwin-freethreaded": "python/install",
754+
"aarch64-unknown-linux-gnu-freethreaded": "python/install",
755+
"ppc64le-unknown-linux-gnu-freethreaded": "python/install",
756+
"riscv64-unknown-linux-gnu-freethreaded": "python/install",
757+
"s390x-unknown-linux-gnu-freethreaded": "python/install",
758+
"x86_64-apple-darwin-freethreaded": "python/install",
759+
"x86_64-pc-windows-msvc-freethreaded": "python/install",
760+
"x86_64-unknown-linux-gnu-freethreaded": "python/install",
761+
},
762+
},
763+
"3.14.0b2": {
764+
"url": "20250610/cpython-{python_version}+20250610-{platform}-{build}.{ext}",
765+
"sha256": {
766+
"aarch64-apple-darwin": "6607351d140e83feb6e11dbde46ab5f99fa9fe039bdbaa12611d26bda0ed9343",
767+
"aarch64-unknown-linux-gnu": "cc388d567f7c23921e0bef8dcae959dfab9ee24d10aeeb23688b21eac402817f",
768+
"ppc64le-unknown-linux-gnu": "f9379ecc5dc71f9c58adf03d5524176ec36e1b40c788d29c260df54d09ad351c",
769+
"riscv64-unknown-linux-gnu": "e6fbe4f7928ec606edee1506752659bf59216fdb208c744d268082ec79b16f42",
770+
"s390x-unknown-linux-gnu": "1cf32c1173adc1cb70952bb47c92177a196f9e83b7a874f09599682e92ba0010",
771+
"x86_64-apple-darwin": "a6d8196b174409e0ce67829c4e4ee5005c4be20a2efb41116e0521ad1fa1a717",
772+
"x86_64-pc-windows-msvc": "0d88ec80c6c3e3ac462368850c19d3930bf2b1a1a5fe89da60c8534d0fac1a01",
773+
"x86_64-unknown-linux-gnu": "93b29eea5214d19f0420ef8e459b007e15ea58349d60811122c78241fe51cb92",
774+
"x86_64-unknown-linux-musl": "90e90a58ebff3416eb5a3f93ecb59b6eda945e2b706f5c13b0ba85f6b2bee130",
775+
"aarch64-apple-darwin-freethreaded": "af0f34aa0dcd02bd3d960a1572a1ed8a17d55b373a22866f05041aaf16f8607d",
776+
"aarch64-unknown-linux-gnu-freethreaded": "e76c7ab98e1c0f86a6996d1ec775ba8497bf46aa8ffa8c7b0f2e761f37305329",
777+
"ppc64le-unknown-linux-gnu-freethreaded": "df2ae00827406e247f1aaaec76ffc7963b909c81075fc9940eee1ea9f753dd16",
778+
"riscv64-unknown-linux-gnu-freethreaded": "09e347cb5f29e0eafd1eba73105ea9d853184b55fbaf4746cebec217430d6db5",
779+
"s390x-unknown-linux-gnu-freethreaded": "f911605eee0eb7845a69acaf8bfb2e1811c76e9a5e3980d97fae93135df4b773",
780+
"x86_64-apple-darwin-freethreaded": "dd27d519cf2a04917cb566366d6539477791d1b2f1fb42037d9179f469ff55a9",
781+
"x86_64-pc-windows-msvc-freethreaded": "da966a17e434094d8f10b719d93c782d82eaf5207f2843cbaa58c3d91a8f0e32",
782+
"x86_64-unknown-linux-gnu-freethreaded": "abd60d3a302e9d9c32ec78581fb3a9903079c56ec7a949ce658a7950423f350a",
783+
},
784+
"strip_prefix": {
785+
"aarch64-apple-darwin": "python",
786+
"aarch64-unknown-linux-gnu": "python",
787+
"ppc64le-unknown-linux-gnu": "python",
788+
"s390x-unknown-linux-gnu": "python",
789+
"riscv64-unknown-linux-gnu": "python",
790+
"x86_64-apple-darwin": "python",
791+
"x86_64-pc-windows-msvc": "python",
792+
"x86_64-unknown-linux-gnu": "python",
793+
"x86_64-unknown-linux-musl": "python",
794+
"aarch64-apple-darwin-freethreaded": "python/install",
795+
"aarch64-unknown-linux-gnu-freethreaded": "python/install",
796+
"ppc64le-unknown-linux-gnu-freethreaded": "python/install",
797+
"riscv64-unknown-linux-gnu-freethreaded": "python/install",
798+
"s390x-unknown-linux-gnu-freethreaded": "python/install",
799+
"x86_64-apple-darwin-freethreaded": "python/install",
800+
"x86_64-pc-windows-msvc-freethreaded": "python/install",
801+
"x86_64-unknown-linux-gnu-freethreaded": "python/install",
802+
},
803+
},
677804
}
678805

679806
# buildifier: disable=unsorted-dict-items
680807
MINOR_MAPPING = {
681808
"3.8": "3.8.20",
682-
"3.9": "3.9.21",
683-
"3.10": "3.10.16",
684-
"3.11": "3.11.11",
685-
"3.12": "3.12.9",
686-
"3.13": "3.13.2",
809+
"3.9": "3.9.23",
810+
"3.10": "3.10.18",
811+
"3.11": "3.11.13",
812+
"3.12": "3.12.11",
813+
"3.13": "3.13.4",
814+
"3.14": "3.14.0b2",
687815
}
688816

689817
def _generate_platforms():

tests/python/python_tests.bzl

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,11 @@ def _test_toolchain_ordering(env):
304304
toolchain = [
305305
_toolchain("3.10"),
306306
_toolchain("3.10.15"),
307-
_toolchain("3.10.16"),
308-
_toolchain("3.10.11"),
307+
_toolchain("3.10.18"),
308+
_toolchain("3.10.13"),
309309
_toolchain("3.11.1"),
310310
_toolchain("3.11.10"),
311-
_toolchain("3.11.11", is_default = True),
311+
_toolchain("3.11.13", is_default = True),
312312
],
313313
),
314314
_mod(name = "rules_python", toolchain = [_toolchain("3.11")]),
@@ -320,14 +320,15 @@ def _test_toolchain_ordering(env):
320320
for t in py.toolchains
321321
]
322322

323-
env.expect.that_str(py.default_python_version).equals("3.11.11")
323+
env.expect.that_str(py.default_python_version).equals("3.11.13")
324324
env.expect.that_dict(py.config.minor_mapping).contains_exactly({
325-
"3.10": "3.10.16",
326-
"3.11": "3.11.11",
327-
"3.12": "3.12.9",
328-
"3.13": "3.13.2",
325+
"3.10": "3.10.18",
326+
"3.11": "3.11.13",
327+
"3.12": "3.12.11",
328+
"3.13": "3.13.4",
329+
"3.14": "3.14.0b2",
329330
"3.8": "3.8.20",
330-
"3.9": "3.9.21",
331+
"3.9": "3.9.23",
331332
})
332333
env.expect.that_collection(got_versions).contains_exactly([
333334
# First the full-version toolchains that are in minor_mapping
@@ -336,13 +337,13 @@ def _test_toolchain_ordering(env):
336337
# The default version is always set in the `python_version` flag, so know, that
337338
# the default match will be somewhere in the first bunch.
338339
"3.10",
339-
"3.10.16",
340+
"3.10.18",
340341
"3.11",
341-
"3.11.11",
342+
"3.11.13",
342343
# Next, the rest, where we will match things based on the `python_version` being
343344
# the same
344345
"3.10.15",
345-
"3.10.11",
346+
"3.10.13",
346347
"3.11.1",
347348
"3.11.10",
348349
]).in_order()

tests/toolchains/defs.bzl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
""
1616

1717
load("//python:versions.bzl", "PLATFORMS", "TOOL_VERSIONS")
18+
load("//python/private:version.bzl", "version") # buildifier: disable=bzl-visibility
1819
load("//tests/support:py_reconfig.bzl", "py_reconfig_test")
1920

2021
def define_toolchain_tests(name):
@@ -38,13 +39,20 @@ def define_toolchain_tests(name):
3839
is_platform = "_is_{}".format(platform_key)
3940
target_compatible_with[is_platform] = []
4041

42+
parsed = version.parse(python_version, strict = True)
43+
expect_python_version = "{0}.{1}.{2}".format(*parsed.release)
44+
if parsed.pre:
45+
expect_python_version = "{0}{1}{2}".format(
46+
expect_python_version,
47+
*parsed.pre
48+
)
4149
py_reconfig_test(
4250
name = "python_{}_test".format(python_version),
4351
srcs = ["python_toolchain_test.py"],
4452
main = "python_toolchain_test.py",
4553
python_version = python_version,
4654
env = {
47-
"EXPECT_PYTHON_VERSION": python_version,
55+
"EXPECT_PYTHON_VERSION": expect_python_version,
4856
},
4957
deps = ["//python/runfiles"],
5058
data = ["//tests/support:current_build_settings"],

tests/toolchains/python_toolchain_test.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,18 @@ def test_expected_toolchain_matches(self):
2727
)
2828
self.assertIn(expected, settings["toolchain_label"], msg)
2929

30-
actual = "{v.major}.{v.minor}.{v.micro}".format(v=sys.version_info)
30+
if sys.version_info.releaselevel == "final":
31+
actual = "{v.major}.{v.minor}.{v.micro}".format(v=sys.version_info)
32+
elif sys.version_info.releaselevel in ["beta"]:
33+
actual = (
34+
"{v.major}.{v.minor}.{v.micro}{v.releaselevel[0]}{v.serial}".format(
35+
v=sys.version_info
36+
)
37+
)
38+
else:
39+
raise NotImplementedError(
40+
"Unsupported release level, please update the test"
41+
)
3142
self.assertEqual(actual, expect_version)
3243

3344

tests/toolchains/transitions/transitions_tests.bzl

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,21 @@ def _impl(ctx):
5656

5757
exec_tools = ctx.toolchains[EXEC_TOOLS_TOOLCHAIN_TYPE].exec_tools
5858
got_version = exec_tools.exec_interpreter[platform_common.ToolchainInfo].py3_runtime.interpreter_version_info
59+
got = "{}.{}.{}".format(
60+
got_version.major,
61+
got_version.minor,
62+
got_version.micro,
63+
)
64+
if got_version.releaselevel != "final":
65+
got = "{}{}{}".format(
66+
got,
67+
got_version.releaselevel[0],
68+
got_version.serial,
69+
)
5970

6071
return [
6172
TestInfo(
62-
got = "{}.{}.{}".format(
63-
got_version.major,
64-
got_version.minor,
65-
got_version.micro,
66-
),
73+
got = got,
6774
want = ctx.attr.want_version,
6875
),
6976
]

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy