Skip to content

Commit fd7d888

Browse files
authored
Make the module extension more user-friendly. (#56)
This is a followup to a post-merge comment on the preceding commit: #55 (comment)
1 parent af7151f commit fd7d888

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

python_configure.bzl

+7-16
Original file line numberDiff line numberDiff line change
@@ -456,22 +456,13 @@ def _parse_my_own_version_from_module_dot_bazel(ctx):
456456
def _extension_impl(ctx):
457457
toolchain = None
458458
for module in ctx.modules:
459-
if module.is_root:
460-
if not module.tags.toolchain:
461-
pass
462-
elif len(module.tags.toolchain) == 1:
463-
toolchain = module.tags.toolchain[0]
464-
else:
465-
_fail("The root module may not specify multiple `toolchain` " +
466-
"tags. Found %r `toolchain` tags specified." % (
467-
len(module.tags.toolchain),
468-
))
469-
elif module.tags.toolchain:
470-
_fail("A non-root module may not specify any `toolchain` tags. " +
471-
"Found %r `toolchain` tags specified by module %r." % (
472-
len(module.tags.toolchain),
473-
module.name,
474-
))
459+
if not module.is_root or not module.tags.toolchain:
460+
continue
461+
toolchain = module.tags.toolchain[0]
462+
if len(module.tags.toolchain) >= 2:
463+
print("The root module specified two or more `toolchain` tags. " +
464+
"Using only the first of %r `toolchain` tags specified." % (
465+
len(module.tags.toolchain)))
475466
if toolchain == None:
476467
python_configure(
477468
name = "local_config_python",

0 commit comments

Comments
 (0)