@@ -29,7 +29,6 @@ behavior.
2929load ("//python/private:normalize_name.bzl" , "normalize_name" )
3030load (":index_sources.bzl" , "index_sources" )
3131load (":parse_requirements_txt.bzl" , "parse_requirements_txt" )
32- load (":requirements_files_by_platform.bzl" , "requirements_files_by_platform" )
3332load (":whl_target_platforms.bzl" , "select_whls" )
3433
3534# This includes the vendored _translate_cpu and _translate_os from
@@ -85,10 +84,6 @@ def parse_requirements(
8584 ctx ,
8685 * ,
8786 requirements_by_platform = {},
88- requirements_osx = None ,
89- requirements_linux = None ,
90- requirements_lock = None ,
91- requirements_windows = None ,
9287 extra_pip_args = [],
9388 get_index_urls = None ,
9489 python_version = None ,
@@ -102,10 +97,6 @@ def parse_requirements(
10297 requirements_by_platform (label_keyed_string_dict): a way to have
10398 different package versions (or different packages) for different
10499 os, arch combinations.
105- requirements_osx (label): The requirements file for the osx OS.
106- requirements_linux (label): The requirements file for the linux OS.
107- requirements_lock (label): The requirements file for all OSes, or used as a fallback.
108- requirements_windows (label): The requirements file for windows OS.
109100 extra_pip_args (string list): Extra pip arguments to perform extra validations and to
110101 be joined with args fined in files.
111102 get_index_urls: Callable[[ctx, list[str]], dict], a callable to get all
@@ -135,17 +126,6 @@ def parse_requirements(
135126
136127 The second element is extra_pip_args should be passed to `whl_library`.
137128 """
138- requirements_by_platform , download_only = requirements_files_by_platform (
139- requirements_by_platform = requirements_by_platform ,
140- requirements_osx = requirements_osx ,
141- requirements_linux = requirements_linux ,
142- requirements_lock = requirements_lock ,
143- requirements_windows = requirements_windows ,
144- extra_pip_args = extra_pip_args ,
145- python_version = python_version ,
146- logger = logger ,
147- )
148-
149129 options = {}
150130 requirements = {}
151131 for file , plats in requirements_by_platform .items ():
@@ -209,7 +189,6 @@ def parse_requirements(
209189 requirement_line = requirement_line ,
210190 target_platforms = [],
211191 extra_pip_args = extra_pip_args ,
212- download = download_only ,
213192 ),
214193 )
215194 for_req .target_platforms .append (target_platform )
@@ -276,7 +255,6 @@ def parse_requirements(
276255 requirement_line = r .requirement_line ,
277256 target_platforms = sorted (target_platforms ),
278257 extra_pip_args = r .extra_pip_args ,
279- download = r .download ,
280258 whls = whls ,
281259 sdist = sdist ,
282260 is_exposed = is_exposed ,
@@ -294,8 +272,9 @@ def select_requirement(requirements, *, platform):
294272 Args:
295273 requirements (list[struct]): The list of requirements as returned by
296274 the `parse_requirements` function above.
297- platform (str): The host platform. Usually an output of the
298- `host_platform` function.
275+ platform (str or None): The host platform. Usually an output of the
276+ `host_platform` function. If None, then this function will return
277+ the first requirement it finds.
299278
300279 Returns:
301280 None if not found or a struct returned as one of the values in the
@@ -305,7 +284,7 @@ def select_requirement(requirements, *, platform):
305284 maybe_requirement = [
306285 req
307286 for req in requirements
308- if [p for p in req .target_platforms if p .endswith (platform )] or req . download
287+ if not platform or [p for p in req .target_platforms if p .endswith (platform )]
309288 ]
310289 if not maybe_requirement :
311290 # Sometimes the package is not present for host platform if there
0 commit comments