Skip to content

Commit e9ba905

Browse files
chore(uv): Cleanup more config_setting_group usage (#732)
### Changes are visible to end-users: no ### Test plan - Covered by existing test cases --------- Co-authored-by: aspect-marvin[bot] <[email protected]>
1 parent 601612a commit e9ba905

File tree

2 files changed

+26
-90
lines changed

2 files changed

+26
-90
lines changed

uv/private/constraints/defs.bzl

Lines changed: 1 addition & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,13 @@
11
"""
2-
Helpes and constants.
2+
Constants.
33
"""
44

5-
load("@bazel_skylib//lib:selects.bzl", "selects")
6-
75
MAJORS = [2, 3] # There is no 4
86
MINORS = range(0, 21)
9-
PATCHES = range(0, 31)
107
INTERPRETERS = [
118
"py", # Generic
129
"cp", # CPython
1310
# "jy", # Jython
1411
# "ip", # IronPython
1512
# "pp", # PyPy, has its own ABI scheme :|
1613
]
17-
18-
# FIXME: We're ignoring these for now which isn't ideal
19-
FLAGS = {
20-
"d": "pydebug",
21-
"m": "pymalloc",
22-
"t": "freethreading",
23-
"u": "wide-unicode", # Deprecated in 3.13
24-
}
25-
26-
def generate_gte_ladder(stages, visibility):
27-
"""Select macro.
28-
29-
Accept a list of names of individual conditions representing specific versions.
30-
These names happen to be in ascending order and are generated by some other codepath.
31-
32-
Given these condition label names generate a sequence ("ladder") of equality
33-
comparison operations + or with the "greater" comparison.
34-
35-
So for [macos_10_0, macos_10_1, macos_11_0, macos_11_1, ...]
36-
We want to get
37-
38-
selects.config_setting_group(
39-
name = "gte_macos_11_0",
40-
match_any = [
41-
":macos_11_0",
42-
":gte_macos_10_1",
43-
],
44-
)
45-
selects.config_setting_group(
46-
name = "gte_macos_10_1",
47-
match_any = [
48-
":macos_10_1",
49-
":gte_macos_10_0",
50-
],
51-
)
52-
53-
As an added refinement the stages are a struct
54-
55-
struct(
56-
name = <name of the ladder step>,
57-
condition = <condition for this ladder step>,
58-
)
59-
60-
Args:
61-
stages (struct): pairs defining the name for a ladder rung and the
62-
condition defining when that rung is matched.
63-
64-
Returns:
65-
None.
66-
67-
"""
68-
69-
# We loop up to the second-to-last item to ensure we always have a 'next' stage.
70-
for i, current_stage in enumerate(stages):
71-
selects.config_setting_group(
72-
name = "{}".format(current_stage.name),
73-
match_any = [
74-
":{}".format(current_stage.condition),
75-
] + ([":{}".format(stages[i + 1].name)] if i + 1 < len(stages) else []),
76-
visibility = visibility,
77-
)

uv/private/constraints/platform/BUILD.bazel

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ selects.config_setting_group(
3131
visibility = ["//visibility:public"],
3232
)
3333

34-
selects.config_setting_group(
34+
alias(
3535
name = "glibc_or_musl",
36-
match_any = [
37-
":is_glibc",
38-
":is_musl",
39-
],
36+
actual = select({
37+
":is_glibc": ":is_glibc",
38+
"//conditions:default": ":is_musl",
39+
}),
4040
visibility = ["//visibility:public"],
4141
)
4242

@@ -90,34 +90,34 @@ alias(
9090
)
9191

9292
# https://packaging.python.org/en/latest/specifications/platform-compatibility-tags/#manylinux
93-
selects.config_setting_group(
93+
alias(
9494
name = "manylinux1",
95-
match_any = [
96-
":manylinux_2_5_x86_64",
97-
":manylinux_2_5_i686",
98-
],
95+
actual = select({
96+
":manylinux_2_5_x86_64": ":manylinux_2_5_x86_64",
97+
"//conditions:default": ":manylinux_2_5_i686",
98+
}),
9999
visibility = ["//visibility:public"],
100100
)
101101

102-
selects.config_setting_group(
102+
alias(
103103
name = "manylinux2010",
104-
match_any = [
105-
":manylinux_2_12_x86_64",
106-
":manylinux_2_12_i686",
107-
],
104+
actual = select({
105+
":manylinux_2_12_x86_64": ":manylinux_2_12_x86_64",
106+
"//conditions:default": ":manylinux_2_12_i686",
107+
}),
108108
visibility = ["//visibility:public"],
109109
)
110110

111-
selects.config_setting_group(
111+
alias(
112112
name = "manylinux2014",
113-
match_any = [
114-
":manylinux_2_17_x86_64",
115-
":manylinux_2_17_i686",
116-
":manylinux_2_17_aarch64",
117-
":manylinux_2_17_armv7l",
118-
":manylinux_2_17_ppc64",
119-
":manylinux_2_17_ppc64le",
120-
":manylinux_2_17_s390x",
121-
],
113+
actual = select({
114+
":manylinux_2_17_x86_64": ":manylinux_2_17_x86_64",
115+
":manylinux_2_17_i686": ":manylinux_2_17_i686",
116+
":manylinux_2_17_aarch64": ":manylinux_2_17_aarch64",
117+
":manylinux_2_17_armv7l": ":manylinux_2_17_armv7l",
118+
":manylinux_2_17_ppc64": ":manylinux_2_17_ppc64",
119+
":manylinux_2_17_ppc64le": ":manylinux_2_17_ppc64le",
120+
"//conditions:default": ":manylinux_2_17_s390x",
121+
}),
122122
visibility = ["//visibility:public"],
123123
)

0 commit comments

Comments
 (0)