Lines Matching +full:toolchain +full:- +full:version
3 # Licensed under the Apache License, Version 2.0 (the "License");
7 # http://www.apache.org/licenses/LICENSE-2.0
15 "Python toolchain module extensions for use with bzlmod."
44 element is special and is treated as the default toolchain.
58 # NOTE: The last element is special: it is treated as the default toolchain,
62 # We store the default toolchain separately to ensure it is the last
63 # toolchain added to toolchains.
74 # if the root module does not register any toolchain then the
76 if not module_ctx.modules[0].tags.toolchain:
101 # toolchain for a couple reasons:
131 # Ignore version collisions in the global scope because there isn't
135 # If the python version is explicitly provided by the root
137 # version that rules_python provides as default.
166 # This toolchain is setting the default, but the actual
181 # A default toolchain is required so that the non-version-specific rules
182 # are able to match a toolchain.
184 fail("No default Python toolchain configured. Is rules_python missing `is_default=True`?")
186 fail('Default version "{python_version}" selected by module ' +
187 '"{module_name}", but no toolchain with that version registered'.format(
192 # The last toolchain in the BUILD file is set as the default
193 # toolchain. We need the default last.
202 default_python_version = toolchains[-1].python_version,
218 # Ensure that we pass the full version here.
220 version = toolchain_info.python_version,
228 # Allow overrides per python version
242 # Last toolchain is default
247 render.toolchain_prefix(index, toolchain.name, _TOOLCHAIN_INDEX_PAD_LENGTH)
248 for index, toolchain in enumerate(py.toolchains)
251 full_version(version = t.python_version, minor_mapping = py.config.minor_mapping)
254 # The last toolchain is the default; it can't have version constraints
257 "True" if i != len(py.toolchains) - 1 else "False"
264 # This is require in order to support multiple version py_test
269 toolchain.python_version: toolchain.name
270 for toolchain in py.toolchains
285 def _fail_duplicate_module_toolchain_version(version, module):
286 fail(("Duplicate module toolchain version: module '{module}' attempted " +
287 "to use version '{version}' multiple times in itself").format(
288 version = version,
292 def _warn_duplicate_global_toolchain_version(version, first, second_toolchain_name, second_module_n…
297 "Ignoring toolchain '{second_toolchain}' from module '{second_module}': " +
298 "Toolchain '{first_toolchain}' from module '{first_module}' " +
299 "already registered Python version {version} and has precedence."
305 version = version,
309 fail(("Multiple default toolchains: only one toolchain " +
311 "was toolchain '{first}'. Second was '{second}'").format(
316 def _validate_version(*, version, _fail = fail):
317 parsed = semver(version)
319 …version' attribute needs to specify an 'X.Y.Z' semver-compatible version, got: '{}'".format(versio…
325 if not _validate_version(version = tag.python_version, _fail = _fail):
375 if not _validate_version(version = tag.python_version, _fail = _fail):
406 _fail("unknown version '{}', known versions are: {}".format(
458 version: {
460 # single version.
471 for version, item in TOOL_VERSIONS.items()
479 # First override by single version, because the sha256 will replace
532 for tag in mod.tags.toolchain:
535 toolchain_tag_count = len(mod.tags.toolchain),
551 fail("Only one of tag and python version can be specified")
553 # A single toolchain is treated as the default because it's unambiguous.
586 It will create a toolchain that is in a sub module, if the toolchain
589 You cannot configure more than one toolchain as the default toolchain.
592 :::{topic} Toolchain set as the default version
594 This extension will not create a toolchain that exists in a sub module,
595 if the sub module toolchain is marked as the default version. If you have
596 more than one toolchain in your root module, you need to set one of the
597 toolchains as the default version. If there is only one toolchain it
598 is set as the default toolchain.
601 :::{topic} Toolchain repository name
603 A toolchain's repository name uses the format `python_{major}_{minor}`, e.g.
605 `major` and `minor` are the Python version from the `python_version` attribute.
607 If a toolchain is registered in `X.Y.Z`, then similarly the toolchain name will
611 :::{topic} Toolchain detection
612 The definition of the first toolchain wins, which means that the root module
613 can override settings for any python toolchain available. This relies on the
622 python.toolchain(
645 If `True`, the Python runtime installation is read-write. This allows the
654 doc = "Whether the toolchain is the default version",
659 The Python version, in `major.minor` or `major.minor.patch` format, e.g
660 `3.12` (or `3.12.3`), to create a toolchain for.
677 If the unknown version given the processing of the extension will fail - all of
699 If `True`, the Python runtime installation is read-write. This allows the
711 version for each minor version. For example if one registers `3.10.3`, `3.10.4`
731 doc = """Override single python version URLs and patches for all platforms.
734 This will replace any existing configuration for the given python version.
738 If you would like to modify the configuration for a specific `(version,
747 # NOTE @aignas 2024-09-01: all of the attributes except for `version`
748 # can be part of the `python.toolchain` call. That would make it more
754 # code in non-root modules, so technically this could be thought as
761 # {attr}`single_version_override.version` only allows patch versions.
775 doc = "Same as the --strip argument of Unix patch.",
780 …tory. They are applied in the list order and are applied before any platform-specific patches are …
784 doc = "The python version to override URLs for. Must be in `X.Y.Z` format.",
797 …doc = "The URL template to fetch releases for this Python version. See {attr}`python.single_versio…
803 doc = """Override single python version for a single existing platform.
805 If the `(version, platform)` is new, we will add it to the existing versions and will
809 If you would like to add or remove platforms to a single python version toolchain
825 doc = "Same as the --strip argument of Unix patch.",
839 doc = "The python version to override URLs for. Must be in `X.Y.Z` format.",
852 …doc = "The URL template to fetch releases for this Python version. If the URL template results in …
865 "toolchain": _toolchain,