Skip to content

Commit ddd8b74

Browse files
UebelAndref0rmiga
andauthored
Allow toolchain registration to be optional (#674)
Co-authored-by: Thulio Ferraz Assis <[email protected]>
1 parent 81c2acf commit ddd8b74

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

python/repositories.bzl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ def python_register_toolchains(
235235
python_version,
236236
distutils = None,
237237
distutils_content = None,
238+
register_toolchains = True,
238239
tool_versions = TOOL_VERSIONS,
239240
**kwargs):
240241
"""Convenience macro for users which does typical setup.
@@ -251,6 +252,7 @@ def python_register_toolchains(
251252
python_version: the Python version.
252253
distutils: see the distutils attribute in the python_repository repository rule.
253254
distutils_content: see the distutils_content attribute in the python_repository repository rule.
255+
register_toolchains: Whether or not to register the downloaded toolchains.
254256
tool_versions: a dict containing a mapping of version with SHASUM and platform info. If not supplied, the defaults
255257
in python/versions.bzl will be used
256258
**kwargs: passed to each python_repositories call.
@@ -282,10 +284,11 @@ def python_register_toolchains(
282284
strip_prefix = strip_prefix,
283285
**kwargs
284286
)
285-
native.register_toolchains("@{name}_toolchains//:{platform}_toolchain".format(
286-
name = name,
287-
platform = platform,
288-
))
287+
if register_toolchains:
288+
native.register_toolchains("@{name}_toolchains//:{platform}_toolchain".format(
289+
name = name,
290+
platform = platform,
291+
))
289292

290293
resolved_interpreter_os_alias(
291294
name = name,

0 commit comments

Comments
 (0)