File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,8 @@ def toolchains_hub(
3030
3131 Args:
3232 name: Unused.
33- names: The names for toolchain targets.
33+ names: The names for toolchain targets. The later occurring items take
34+ precedence over the previous items if they match the target platform.
3435 implementations: The name to label mapping.
3536 target_compatible_with: The name to target_compatible_with list mapping.
3637 target_settings: The name to target_settings list mapping.
@@ -50,7 +51,11 @@ def toolchains_hub(
5051 prefix_len = len (str (len (names )))
5152 prefix = "0" * (prefix_len - 1 )
5253
53- for i , name in sorted (enumerate (names ), key = lambda x : - x [0 ]):
54+ # reverse the names list so that the later items override earlier toolchain
55+ # registrations.
56+ names = [n for _ , n in sorted (enumerate (names ), key = lambda x : - x [0 ])]
57+
58+ for i , name in enumerate (names ):
5459 # prefix with a prefix and then truncate the string.
5560 number_prefix = "{}{}" .format (prefix , i )[- prefix_len :]
5661
Original file line number Diff line number Diff line change @@ -5,10 +5,10 @@ toolchains_hub(
55 "bar" : "//tests/uv/uv:fake_bar" ,
66 "foo" : "//tests/uv/uv:fake_foof" ,
77 },
8- # We expect bar to not be effective here
8+ # We expect foo to take precedence over bar
99 names = [
10- "foo" ,
1110 "bar" ,
11+ "foo" ,
1212 ],
1313 target_compatible_with = {
1414 "bar" : [
You can’t perform that action at this time.
0 commit comments