@@ -20,6 +20,8 @@ load("//python/private:repo_utils.bzl", "REPO_DEBUG_ENV_VAR", "REPO_VERBOSITY_EN
2020load ("//python/private/pypi:hub_builder.bzl" , _hub_builder = "hub_builder" ) # buildifier: disable=bzl-visibility
2121load ("//python/private/pypi:parse_simpleapi_html.bzl" , "parse_simpleapi_html" ) # buildifier: disable=bzl-visibility
2222load ("//python/private/pypi:whl_config_setting.bzl" , "whl_config_setting" ) # buildifier: disable=bzl-visibility
23+ load ("//tests/pypi/extension:pip_parse.bzl" , _parse = "pip_parse" )
24+ load ("//python/private/pypi:platform.bzl" , _plat = "platform" )
2325
2426_tests = []
2527
@@ -36,33 +38,6 @@ simple==0.0.1 \
3638 --hash=sha256:deadbaaf""" ),
3739 )
3840
39- # TODO @aignas 2025-09-07: reuse the same function from
40- # //python/private/pypi:extension.bzl
41- def _plat (* , name , arch_name , os_name , config_settings = [], env = {}, marker = "" , whl_abi_tags = [], whl_platform_tags = []):
42- # NOTE @aignas 2025-07-08: the least preferred is the first item in the list
43- if "any" not in whl_platform_tags :
44- # the lowest priority one needs to be the first one
45- whl_platform_tags = ["any" ] + whl_platform_tags
46-
47- whl_abi_tags = whl_abi_tags or ["abi3" , "cp{major}{minor}" ]
48- if "none" not in whl_abi_tags :
49- # the lowest priority one needs to be the first one
50- whl_abi_tags = ["none" ] + whl_abi_tags
51-
52- return struct (
53- name = name ,
54- arch_name = arch_name ,
55- os_name = os_name ,
56- config_settings = config_settings ,
57- env = {
58- # defaults for env
59- "implementation_name" : "cpython" ,
60- } | env ,
61- marker = marker ,
62- whl_abi_tags = whl_abi_tags ,
63- whl_platform_tags = whl_platform_tags ,
64- )
65-
6641def hub_builder (
6742 env ,
6843 enable_pipstar = 0 ,
@@ -108,14 +83,17 @@ def hub_builder(
10883 },
10984 simpleapi_download_fn = simpleapi_download_fn or (lambda * a , ** k : {}),
11085 evaluate_markers_fn = evaluate_markers_fn ,
111- logger = repo_utils .logger (struct (
112- os = struct (
113- environ = {
114- REPO_DEBUG_ENV_VAR : "1" ,
115- REPO_VERBOSITY_ENV_VAR : "TRACE" if debug else "INFO" ,
116- },
86+ logger = repo_utils .logger (
87+ struct (
88+ os = struct (
89+ environ = {
90+ REPO_DEBUG_ENV_VAR : "1" ,
91+ REPO_VERBOSITY_ENV_VAR : "TRACE" if debug else "FAIL" ,
92+ },
93+ ),
11794 ),
118- ), "unit-test" ),
95+ "unit-test" ,
96+ ),
11997 )
12098 self = struct (
12199 build = lambda * a , ** k : env .expect .that_struct (
@@ -132,74 +110,6 @@ def hub_builder(
132110 )
133111 return self
134112
135- def _parse (
136- * ,
137- hub_name ,
138- python_version ,
139- add_libdir_to_library_search_path = False ,
140- auth_patterns = {},
141- download_only = False ,
142- enable_implicit_namespace_pkgs = False ,
143- environment = {},
144- envsubst = {},
145- experimental_index_url = "" ,
146- experimental_requirement_cycles = {},
147- experimental_target_platforms = [],
148- extra_hub_aliases = {},
149- extra_pip_args = [],
150- isolated = True ,
151- netrc = None ,
152- parse_all_requirements_files = True ,
153- pip_data_exclude = None ,
154- python_interpreter = None ,
155- python_interpreter_target = None ,
156- quiet = True ,
157- requirements_by_platform = {},
158- requirements_darwin = None ,
159- requirements_linux = None ,
160- requirements_lock = None ,
161- requirements_windows = None ,
162- simpleapi_skip = [],
163- timeout = 600 ,
164- whl_modifications = {},
165- ** kwargs ):
166- return struct (
167- auth_patterns = auth_patterns ,
168- add_libdir_to_library_search_path = add_libdir_to_library_search_path ,
169- download_only = download_only ,
170- enable_implicit_namespace_pkgs = enable_implicit_namespace_pkgs ,
171- environment = environment ,
172- envsubst = envsubst ,
173- experimental_index_url = experimental_index_url ,
174- experimental_requirement_cycles = experimental_requirement_cycles ,
175- experimental_target_platforms = experimental_target_platforms ,
176- extra_hub_aliases = extra_hub_aliases ,
177- extra_pip_args = extra_pip_args ,
178- hub_name = hub_name ,
179- isolated = isolated ,
180- netrc = netrc ,
181- parse_all_requirements_files = parse_all_requirements_files ,
182- pip_data_exclude = pip_data_exclude ,
183- python_interpreter = python_interpreter ,
184- python_interpreter_target = python_interpreter_target ,
185- python_version = python_version ,
186- quiet = quiet ,
187- requirements_by_platform = requirements_by_platform ,
188- requirements_darwin = requirements_darwin ,
189- requirements_linux = requirements_linux ,
190- requirements_lock = requirements_lock ,
191- requirements_windows = requirements_windows ,
192- timeout = timeout ,
193- whl_modifications = whl_modifications ,
194- # The following are covered by other unit tests
195- experimental_extra_index_urls = [],
196- parallel_download = False ,
197- experimental_index_url_overrides = {},
198- simpleapi_skip = simpleapi_skip ,
199- _evaluate_markers_srcs = [],
200- ** kwargs
201- )
202-
203113def _test_simple (env ):
204114 builder = hub_builder (env )
205115 builder .pip_parse (
0 commit comments