Skip to content

Commit ffe70cb

Browse files
committed
comment: use a constant
1 parent b53073a commit ffe70cb

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

python/private/python_repository.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"""This file contains repository rules and macros to support toolchain registration.
1616
"""
1717

18-
load("//python:versions.bzl", "PLATFORMS")
18+
load("//python:versions.bzl", "FREETHREADED", "PLATFORMS")
1919
load(":auth.bzl", "get_auth")
2020
load(":repo_utils.bzl", "REPO_DEBUG_ENV_VAR", "repo_utils")
2121
load(":text_util.bzl", "render")
@@ -64,7 +64,7 @@ def _python_repository_impl(rctx):
6464
python_version = rctx.attr.python_version
6565
python_version_info = python_version.split(".")
6666
release_filename = rctx.attr.release_filename
67-
version_suffix = "t" if "freethreaded" in release_filename else ""
67+
version_suffix = "t" if FREETHREADED in release_filename else ""
6868
python_short_version = "{0}.{1}{suffix}".format(
6969
suffix = version_suffix,
7070
*python_version_info

python/versions.bzl

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -724,11 +724,11 @@ def _generate_platforms():
724724
os_name = v.os_name,
725725
arch = v.arch,
726726
)
727+
for p, v in platforms.items()
727728
for suffix, freethreaded_value in {
728729
"": "no",
729-
"-freethreaded": "yes",
730+
"-" + FREETHREADED: "yes",
730731
}.items()
731-
for p, v in platforms.items()
732732
}
733733

734734
PLATFORMS = _generate_platforms()
@@ -761,18 +761,21 @@ def get_release_info(platform, python_version, base_url = DEFAULT_RELEASE_BASE_U
761761
release_filename = None
762762
rendered_urls = []
763763
for u in url:
764-
p, _, _ = platform.partition("-freethreaded")
765-
766-
if "freethreaded" in platform:
767-
build = "freethreaded+{}-full".format({
768-
"aarch64-apple-darwin": "pgo+lto",
769-
"aarch64-unknown-linux-gnu": "lto",
770-
"ppc64le-unknown-linux-gnu": "lto",
771-
"s390x-unknown-linux-gnu": "lto",
772-
"x86_64-apple-darwin": "pgo+lto",
773-
"x86_64-pc-windows-msvc": "pgo",
774-
"x86_64-unknown-linux-gnu": "pgo+lto",
775-
}[p])
764+
p, _, _ = platform.partition("-" + FREETHREADED)
765+
766+
if FREETHREADED in platform:
767+
build = "{}+{}-full".format(
768+
FREETHREADED,
769+
{
770+
"aarch64-apple-darwin": "pgo+lto",
771+
"aarch64-unknown-linux-gnu": "lto",
772+
"ppc64le-unknown-linux-gnu": "lto",
773+
"s390x-unknown-linux-gnu": "lto",
774+
"x86_64-apple-darwin": "pgo+lto",
775+
"x86_64-pc-windows-msvc": "pgo",
776+
"x86_64-unknown-linux-gnu": "pgo+lto",
777+
}[p],
778+
)
776779
else:
777780
build = "install_only"
778781

0 commit comments

Comments
 (0)