Skip to content

Commit adc300e

Browse files
committed
consts with hyphen, sort that supports ft+musl
1 parent 72161e6 commit adc300e

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

python/private/toolchains_repo.bzl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -462,12 +462,10 @@ def sorted_host_platforms(platform_map):
462462

463463
def platform_keyer(name):
464464
# Ascending sort: lower is higher precedence
465-
pref = 0
466-
if name.endswith("-" + FREETHREADED):
467-
pref = 1
468-
elif name.endswith("-" + MUSL):
469-
pref = 2
470-
return (pref, name)
465+
return (
466+
1 if MUSL in name else 0,
467+
1 if FREETHREADED in name else 0,
468+
)
471469

472470
sorted_platform_keys = sorted(platform_map.keys(), key = platform_keyer)
473471
return {

python/versions.bzl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ MACOS_NAME = "osx"
2020
LINUX_NAME = "linux"
2121
WINDOWS_NAME = "windows"
2222

23-
FREETHREADED = "freethreaded"
24-
MUSL = "musl"
23+
FREETHREADED = "-freethreaded"
24+
MUSL = "-musl"
2525
INSTALL_ONLY = "install_only"
2626

2727
DEFAULT_RELEASE_BASE_URL = "https://github.com/astral-sh/python-build-standalone/releases/download"
@@ -847,7 +847,7 @@ def _generate_platforms():
847847
for p, v in platforms.items()
848848
for suffix, freethreadedness in {
849849
"": is_freethreaded_no,
850-
"-" + FREETHREADED: is_freethreaded_yes,
850+
FREETHREADED: is_freethreaded_yes,
851851
}.items()
852852
}
853853

@@ -881,11 +881,11 @@ def get_release_info(platform, python_version, base_url = DEFAULT_RELEASE_BASE_U
881881
release_filename = None
882882
rendered_urls = []
883883
for u in url:
884-
p, _, _ = platform.partition("-" + FREETHREADED)
884+
p, _, _ = platform.partition(FREETHREADED)
885885

886-
if FREETHREADED in platform:
886+
if FREETHREADED.lstrip("-") in platform:
887887
build = "{}+{}-full".format(
888-
FREETHREADED,
888+
FREETHREADED.lstrip("-"),
889889
{
890890
"aarch64-apple-darwin": "pgo+lto",
891891
"aarch64-unknown-linux-gnu": "lto",

0 commit comments

Comments
 (0)