@@ -24,7 +24,7 @@ load("//python/private:normalize_name.bzl", "normalize_name")
2424load ("//python/private:repo_utils.bzl" , "repo_utils" )
2525load ("//python/private:version.bzl" , "version" )
2626load (":attrs.bzl" , "use_isolated" )
27- load (":evaluate_markers.bzl" , "evaluate_markers_py" , EVALUATE_MARKERS_SRCS = "SRCS" , evaluate_markers_star = "evaluate_markers " )
27+ load (":evaluate_markers.bzl" , EVALUATE_MARKERS_SRCS = "SRCS" )
2828load (":hub_builder.bzl" , "hub_builder" )
2929load (":hub_repository.bzl" , "hub_repository" , "whl_config_settings_to_json" )
3030load (":parse_requirements.bzl" , "parse_requirements" )
@@ -72,8 +72,7 @@ def _create_whl_repos(
7272 pip_attr ,
7373 whl_overrides ,
7474 hub ,
75- minor_mapping = MINOR_MAPPING ,
76- evaluate_markers = None ):
75+ minor_mapping = MINOR_MAPPING ):
7776 """create all of the whl repositories
7877
7978 Args:
@@ -83,7 +82,6 @@ def _create_whl_repos(
8382 hub: TODO.
8483 minor_mapping: {type}`dict[str, str]` The dictionary needed to resolve the full
8584 python version used to parse package METADATA files.
86- evaluate_markers: the function used to evaluate the markers.
8785
8886 Returns a {type}`struct` with the following attributes:
8987 whl_map: {type}`dict[str, list[struct]]` the output is keyed by the
@@ -127,44 +125,6 @@ def _create_whl_repos(
127125
128126 platforms = hub .platforms (pip_attr .python_version )
129127
130- if evaluate_markers :
131- # This is most likely unit tests
132- pass
133- elif hub .config .enable_pipstar :
134- evaluate_markers = lambda _ , requirements : evaluate_markers_star (
135- requirements = requirements ,
136- platforms = platforms ,
137- )
138- else :
139- # NOTE @aignas 2024-08-02: , we will execute any interpreter that we find either
140- # in the PATH or if specified as a label. We will configure the env
141- # markers when evaluating the requirement lines based on the output
142- # from the `requirements_files_by_platform` which should have something
143- # similar to:
144- # {
145- # "//:requirements.txt": ["cp311_linux_x86_64", ...]
146- # }
147- #
148- # We know the target python versions that we need to evaluate the
149- # markers for and thus we don't need to use multiple python interpreter
150- # instances to perform this manipulation. This function should be executed
151- # only once by the underlying code to minimize the overhead needed to
152- # spin up a Python interpreter.
153- evaluate_markers = lambda module_ctx , requirements : evaluate_markers_py (
154- module_ctx ,
155- requirements = {
156- k : {
157- p : platforms [p ].triple
158- for p in plats
159- }
160- for k , plats in requirements .items ()
161- },
162- python_interpreter = interpreter .path ,
163- python_interpreter_target = interpreter .target ,
164- srcs = pip_attr ._evaluate_markers_srcs ,
165- logger = logger ,
166- )
167-
168128 requirements_by_platform = parse_requirements (
169129 module_ctx ,
170130 requirements_by_platform = requirements_files_by_platform (
@@ -184,7 +144,7 @@ def _create_whl_repos(
184144 platforms = platforms ,
185145 extra_pip_args = pip_attr .extra_pip_args ,
186146 get_index_urls = hub .get_index_urls (pip_attr .python_version ),
187- evaluate_markers = evaluate_markers ,
147+ evaluate_markers = hub . evaluate_markers ( pip_attr ) ,
188148 logger = logger ,
189149 )
190150
@@ -536,7 +496,9 @@ You cannot use both the additive_build_content and additive_build_content_file a
536496 simpleapi_download_fn = simpleapi_download ,
537497 simpleapi_cache = simpleapi_cache ,
538498 minor_mapping = kwargs .get ("minor_mapping" , MINOR_MAPPING ),
539- available_interpreters = kwargs .pop ("available_interpreters" , INTERPRETER_LABELS ),
499+ evaluate_markers_fn = kwargs .get ("evaluate_markers" , None ),
500+ available_interpreters = kwargs .get ("available_interpreters" , INTERPRETER_LABELS ),
501+ logger = repo_utils .logger (module_ctx , "pypi:hub:" + hub_name ),
540502 )
541503 pip_hub_map [pip_attr .hub_name ] = builder
542504 elif pip_hub_map [hub_name ].module_name != mod .name :
@@ -564,7 +526,7 @@ You cannot use both the additive_build_content and additive_build_content_file a
564526 hub = builder ,
565527 pip_attr = pip_attr ,
566528 whl_overrides = whl_overrides ,
567- ** kwargs
529+ minor_mapping = kwargs . get ( "minor_mapping" , MINOR_MAPPING ),
568530 )
569531
570532 extra_aliases .setdefault (hub_name , {})
0 commit comments