Skip to content

Commit 31cb09c

Browse files
authored
Update python/private/python.bzl
1 parent f2cc08a commit 31cb09c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

python/private/python.bzl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,11 @@ def parse_modules(*, module_ctx, _fail = fail):
104104
# * rules_python needs to set a soft default in case the root module doesn't,
105105
# e.g. if the root module doesn't use Python itself.
106106
# * The root module is allowed to override the rules_python default.
107-
if toolchain_attr.default_version_file == None:
108-
is_default = toolchain_attr.is_default
107+
if toolchain_attr.default_version_file:
108+
version_from_file = module_ctx.read(toolchain_attr.default_version_file).strip()
109+
is_default = version_from_file == toolchain_version
109110
else:
110-
is_default = (
111-
module_ctx.read(toolchain_attr.default_version_file) == toolchain_version
112-
)
111+
is_default = toolchain_attr.is_default
113112
if toolchain_attr.is_default and not is_default:
114113
fail("The 'is_default' attribute doesn't work if you set 'default_version_file'.")
115114

0 commit comments

Comments
 (0)