@@ -110,7 +110,6 @@ _tests.append(_test_legacy_aliases)
110110def  _test_bzlmod_aliases (env ):
111111    # Use this function as it is used in pip_repository 
112112    actual  =  render_multiplatform_pkg_aliases (
113-         default_config_setting  =  "//:my_config_setting" ,
114113        aliases  =  {
115114            "bar-baz" : [
116115                whl_alias (version  =  "3.2" , repo  =  "pypi_32_bar_baz" , config_setting  =  "//:my_config_setting" ),
@@ -124,6 +123,23 @@ load("@bazel_skylib//lib:selects.bzl", "selects")
124123
125124package(default_visibility = ["//visibility:public"]) 
126125
126+ _NO_MATCH_ERROR = \" \" \" \\  
127+ No matching wheel for current configuration's Python version. 
128+ 
129+ The current build configuration's Python version doesn't match any of the Python 
130+ wheels available for this wheel. This wheel supports the following Python 
131+ configuration settings: 
132+     //:my_config_setting 
133+ 
134+ To determine the current configuration's Python version, run: 
135+     `bazel config <config id>` (shown further below) 
136+ and look for 
137+     rules_python//python/config_settings:python_version 
138+ 
139+ If the value is missing, then the "default" Python version is being used, 
140+ which has a "null" version value and will not match version constraints. 
141+ \" \" \" 
142+ 
127143alias( 
128144    name = "bar_baz", 
129145    actual = ":pkg", 
@@ -133,47 +149,39 @@ alias(
133149    name = "pkg", 
134150    actual = selects.with_or( 
135151        { 
136-             ( 
137-                 "//:my_config_setting", 
138-                 "//conditions:default", 
139-             ): "@pypi_32_bar_baz//:pkg", 
152+             "//:my_config_setting": "@pypi_32_bar_baz//:pkg", 
140153        }, 
154+         no_match_error = _NO_MATCH_ERROR, 
141155    ), 
142156) 
143157
144158alias( 
145159    name = "whl", 
146160    actual = selects.with_or( 
147161        { 
148-             ( 
149-                 "//:my_config_setting", 
150-                 "//conditions:default", 
151-             ): "@pypi_32_bar_baz//:whl", 
162+             "//:my_config_setting": "@pypi_32_bar_baz//:whl", 
152163        }, 
164+         no_match_error = _NO_MATCH_ERROR, 
153165    ), 
154166) 
155167
156168alias( 
157169    name = "data", 
158170    actual = selects.with_or( 
159171        { 
160-             ( 
161-                 "//:my_config_setting", 
162-                 "//conditions:default", 
163-             ): "@pypi_32_bar_baz//:data", 
172+             "//:my_config_setting": "@pypi_32_bar_baz//:data", 
164173        }, 
174+         no_match_error = _NO_MATCH_ERROR, 
165175    ), 
166176) 
167177
168178alias( 
169179    name = "dist_info", 
170180    actual = selects.with_or( 
171181        { 
172-             ( 
173-                 "//:my_config_setting", 
174-                 "//conditions:default", 
175-             ): "@pypi_32_bar_baz//:dist_info", 
182+             "//:my_config_setting": "@pypi_32_bar_baz//:dist_info", 
176183        }, 
184+         no_match_error = _NO_MATCH_ERROR, 
177185    ), 
178186)""" 
179187
@@ -198,7 +206,6 @@ _tests.append(_test_bzlmod_aliases)
198206
199207def  _test_bzlmod_aliases_with_no_default_version (env ):
200208    actual  =  render_multiplatform_pkg_aliases (
201-         default_config_setting  =  None ,
202209        aliases  =  {
203210            "bar-baz" : [
204211                whl_alias (
@@ -291,106 +298,8 @@ alias(
291298
292299_tests .append (_test_bzlmod_aliases_with_no_default_version )
293300
294- def  _test_bzlmod_aliases_for_non_root_modules (env ):
295-     actual  =  render_pkg_aliases (
296-         # NOTE @aignas 2024-01-17: if the default X.Y version coincides with the 
297-         # versions that are used in the root module, then this would be the same as 
298-         # as _test_bzlmod_aliases. 
299-         # 
300-         # However, if the root module uses a different default version than the 
301-         # non-root module, then we will have a no-match-error because the 
302-         # default_config_setting is not in the list of the versions in the 
303-         # whl_map. 
304-         default_config_setting  =  "//_config:is_python_3.3" ,
305-         aliases  =  {
306-             "bar-baz" : [
307-                 whl_alias (version  =  "3.2" , repo  =  "pypi_32_bar_baz" ),
308-                 whl_alias (version  =  "3.1" , repo  =  "pypi_31_bar_baz" ),
309-             ],
310-         },
311-     )
312- 
313-     want_key  =  "bar_baz/BUILD.bazel" 
314-     want_content  =  """\  
315- 
316- 
317- package(default_visibility = ["//visibility:public"]) 
318- 
319- _NO_MATCH_ERROR = \" \" \" \\  
320- No matching wheel for current configuration's Python version. 
321- 
322- The current build configuration's Python version doesn't match any of the Python 
323- wheels available for this wheel. This wheel supports the following Python 
324- configuration settings: 
325-     //_config:is_python_3.1 
326-     //_config:is_python_3.2 
327- 
328- To determine the current configuration's Python version, run: 
329-     `bazel config <config id>` (shown further below) 
330- and look for 
331-     rules_python//python/config_settings:python_version 
332- 
333- If the value is missing, then the "default" Python version is being used, 
334- which has a "null" version value and will not match version constraints. 
335- \" \" \" 
336- 
337- alias( 
338-     name = "bar_baz", 
339-     actual = ":pkg", 
340- ) 
341- 
342- alias( 
343-     name = "pkg", 
344-     actual = selects.with_or( 
345-         { 
346-             "//_config:is_python_3.1": "@pypi_31_bar_baz//:pkg", 
347-             "//_config:is_python_3.2": "@pypi_32_bar_baz//:pkg", 
348-         }, 
349-         no_match_error = _NO_MATCH_ERROR, 
350-     ), 
351- ) 
352- 
353- alias( 
354-     name = "whl", 
355-     actual = selects.with_or( 
356-         { 
357-             "//_config:is_python_3.1": "@pypi_31_bar_baz//:whl", 
358-             "//_config:is_python_3.2": "@pypi_32_bar_baz//:whl", 
359-         }, 
360-         no_match_error = _NO_MATCH_ERROR, 
361-     ), 
362- ) 
363- 
364- alias( 
365-     name = "data", 
366-     actual = selects.with_or( 
367-         { 
368-             "//_config:is_python_3.1": "@pypi_31_bar_baz//:data", 
369-             "//_config:is_python_3.2": "@pypi_32_bar_baz//:data", 
370-         }, 
371-         no_match_error = _NO_MATCH_ERROR, 
372-     ), 
373- ) 
374- 
375- alias( 
376-     name = "dist_info", 
377-     actual = selects.with_or( 
378-         { 
379-             "//_config:is_python_3.1": "@pypi_31_bar_baz//:dist_info", 
380-             "//_config:is_python_3.2": "@pypi_32_bar_baz//:dist_info", 
381-         }, 
382-         no_match_error = _NO_MATCH_ERROR, 
383-     ), 
384- )""" 
385- 
386-     env .expect .that_collection (actual .keys ()).contains_exactly ([want_key ])
387-     env .expect .that_str (actual [want_key ]).equals (want_content )
388- 
389- _tests .append (_test_bzlmod_aliases_for_non_root_modules )
390- 
391301def  _test_aliases_are_created_for_all_wheels (env ):
392302    actual  =  render_pkg_aliases (
393-         default_config_setting  =  "//_config:is_python_3.2" ,
394303        aliases  =  {
395304            "bar" : [
396305                whl_alias (version  =  "3.1" , repo  =  "pypi_31_bar" ),
@@ -414,7 +323,6 @@ _tests.append(_test_aliases_are_created_for_all_wheels)
414323
415324def  _test_aliases_with_groups (env ):
416325    actual  =  render_pkg_aliases (
417-         default_config_setting  =  "//_config:is_python_3.2" ,
418326        aliases  =  {
419327            "bar" : [
420328                whl_alias (version  =  "3.1" , repo  =  "pypi_31_bar" ),
0 commit comments