Allow toolchain registration to be optional (#674)

Co-authored-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com>
diff --git a/python/repositories.bzl b/python/repositories.bzl
index 3575ea8..395ef0e 100644
--- a/python/repositories.bzl
+++ b/python/repositories.bzl
@@ -235,6 +235,7 @@
         python_version,
         distutils = None,
         distutils_content = None,
+        register_toolchains = True,
         tool_versions = TOOL_VERSIONS,
         **kwargs):
     """Convenience macro for users which does typical setup.
@@ -251,6 +252,7 @@
         python_version: the Python version.
         distutils: see the distutils attribute in the python_repository repository rule.
         distutils_content: see the distutils_content attribute in the python_repository repository rule.
+        register_toolchains: Whether or not to register the downloaded toolchains.
         tool_versions: a dict containing a mapping of version with SHASUM and platform info. If not supplied, the defaults
         in python/versions.bzl will be used
         **kwargs: passed to each python_repositories call.
@@ -282,10 +284,11 @@
             strip_prefix = strip_prefix,
             **kwargs
         )
-        native.register_toolchains("@{name}_toolchains//:{platform}_toolchain".format(
-            name = name,
-            platform = platform,
-        ))
+        if register_toolchains:
+            native.register_toolchains("@{name}_toolchains//:{platform}_toolchain".format(
+                name = name,
+                platform = platform,
+            ))
 
     resolved_interpreter_os_alias(
         name = name,