Skip to content

Commit 99fc56a

Browse files
authored
Add fail for invalid python version transition (#28)
Since it's common to use 3_12 etc versions various places in bazel, this makes sure if you ever accidentally use that in the transition that it fails, since otherwise it will fail with an opaque toolchain error
1 parent 5d2f3b1 commit 99fc56a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

mojo/private/transitions.bzl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ _PYTHON_VERSION = "@rules_python//python/config_settings:python_version"
55
def _python_version_transition_impl(settings, attr):
66
output = {_PYTHON_VERSION: settings[_PYTHON_VERSION]}
77
if attr.python_version:
8+
if "_" in attr.python_version:
9+
fail("error: invalid python version: ", attr.python_version)
810
output["@rules_python//python/config_settings:python_version"] = str(attr.python_version)
11+
912
return output
1013

1114
python_version_transition = transition(

0 commit comments

Comments
 (0)