chore: remove dead code from whl_target_platforms (#2001)

Remove dead code only used in tests.

Work towards #260
diff --git a/python/private/whl_target_platforms.bzl b/python/private/whl_target_platforms.bzl
index 08177ca..bee7957 100644
--- a/python/private/whl_target_platforms.bzl
+++ b/python/private/whl_target_platforms.bzl
@@ -46,63 +46,6 @@
     "win": "windows",
 }  # buildifier: disable=unsorted-dict-items
 
-def _whl_priority(value):
-    """Return a value for sorting whl lists.
-
-    TODO @aignas 2024-03-29: In the future we should create a repo for each
-    repo that matches the abi and then we could have config flags for the
-    preference of `any` wheels or `sdist` or `manylinux` vs `musllinux` or
-    `universal2`. Ideally we use `select` statements in the hub repo to do
-    the selection based on the config, but for now this is the best way to
-    get this working for the host platform.
-
-    In the future the right thing would be to have `bool_flag` or something
-    similar to be able to have select statements that does the right thing:
-    * select whls vs sdists.
-    * select manylinux vs musllinux
-    * select universal2 vs arch-specific whls
-
-    All of these can be expressed as configuration settings and included in the
-    select statements in the `whl` repo. This means that the user can configure
-    for a particular target what they need.
-
-    Returns a 4-tuple where the items are:
-        * bool - is it an 'any' wheel? True if it is.
-        * bool - is it an 'universal' wheel? True if it is. (e.g. macos universal2 wheels)
-        * int - the minor plaform version (e.g. osx os version, libc version)
-        * int - the major plaform version (e.g. osx os version, libc version)
-    """
-    if "." in value:
-        value, _, _ = value.partition(".")
-
-    if "any" == value:
-        return (True, False, 0, 0)
-
-    if "linux" in value:
-        os, _, tail = value.partition("_")
-        if os == "linux":
-            # If the platform tag starts with 'linux', then return something less than what 'any' returns
-            minor = 0
-            major = 0
-        else:
-            major, _, tail = tail.partition("_")  # We don't need to use that because it's the same for all candidates now
-            minor, _, _ = tail.partition("_")
-
-        return (False, os == "linux", int(minor), int(major))
-
-    if "mac" in value or "osx" in value:
-        _, _, tail = value.partition("_")
-        major, _, tail = tail.partition("_")
-        minor, _, _ = tail.partition("_")
-
-        return (False, "universal2" in value, int(minor), int(major))
-
-    if not "win" in value:
-        fail("BUG: only windows, linux and mac platforms are supported, but got: {}".format(value))
-
-    # Windows does not have multiple wheels for the same target platform
-    return (False, False, 0, 0)
-
 def select_whls(*, whls, want_python_version = "3.0", want_abis = [], want_platforms = [], logger = None):
     """Select a subset of wheels suitable for target platforms from a list.
 
@@ -203,46 +146,6 @@
         for key, v in candidates.items()
     ]
 
-def select_whl(*, whls, want_platform):
-    """Select a suitable wheel from a list.
-
-    Args:
-        whls(list[struct]): A list of candidates.
-        want_platform(str): The target platform.
-
-    Returns:
-        None or a struct with `url`, `sha256` and `filename` attributes for the
-        selected whl. If no match is found, None is returned.
-    """
-    if not whls:
-        return None
-
-    # TODO @aignas 2024-05-23: once we do the selection in the hub repo using
-    # an actual select, then this function will be the one that is used within
-    # the repository context instead of `select_whl`.
-    whls = select_whls(
-        whls = whls,
-        want_python_version = "",
-        want_platforms = [want_platform],
-    )
-
-    candidates = {
-        parse_whl_name(w.filename).platform_tag: w
-        for w in whls
-        # TODO @aignas 2024-06-01: to be addressed in #1837, where we add the necessary
-        # config settings.
-        if "musllinux_" not in w.filename
-    }
-
-    target_whl_platform = sorted(
-        candidates.keys(),
-        key = _whl_priority,
-    )
-    if not target_whl_platform:
-        return None
-
-    return candidates[target_whl_platform[0]]
-
 def whl_target_platforms(platform_tag, abi_tag = ""):
     """Parse the wheel abi and platform tags and return (os, cpu) tuples.
 
diff --git a/tests/private/whl_target_platforms/select_whl_tests.bzl b/tests/private/whl_target_platforms/select_whl_tests.bzl
index ebd2b26..59e9d77 100644
--- a/tests/private/whl_target_platforms/select_whl_tests.bzl
+++ b/tests/private/whl_target_platforms/select_whl_tests.bzl
@@ -15,7 +15,7 @@
 ""
 
 load("@rules_testing//lib:test_suite.bzl", "test_suite")
-load("//python/private:whl_target_platforms.bzl", "select_whl", "select_whls")  # buildifier: disable=bzl-visibility
+load("//python/private:whl_target_platforms.bzl", "select_whls")  # buildifier: disable=bzl-visibility
 
 WHL_LIST = [
     "pkg-0.0.1-cp311-cp311-macosx_10_9_universal2.whl",
@@ -79,11 +79,6 @@
         # Check that we pass the original structs
         env.expect.that_str(got[0].other).equals("dummy")
 
-def _select_whl(**kwargs):
-    """A small wrapper to make the tests more DRY."""
-    got_single = select_whl(**kwargs)
-    return [got_single] if got_single else []
-
 def _select_whls(whls, **kwargs):
     return select_whls(
         whls = [
@@ -214,8 +209,6 @@
         "pkg-0.0.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
         "pkg-0.0.1-cp37-cp37m-musllinux_1_1_x86_64.whl",
     )
-    got = _select_whl(whls = got, want_platform = "linux_x86_64")
-    _match(env, got, "pkg-0.0.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl")
 
 _tests.append(_test_match_abi_and_not_py_version)
 
@@ -228,8 +221,6 @@
         "pkg-0.0.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl",
         "pkg-0.0.1-cp39-cp39-musllinux_1_1_i686.whl",
     )
-    got = _select_whl(whls = got, want_platform = "linux_x86_32")
-    _match(env, got, "pkg-0.0.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl")
 
 _tests.append(_test_select_filename_with_many_tags)
 
@@ -247,8 +238,6 @@
         "pkg-0.0.1-cp311-cp311-macosx_10_9_universal2.whl",
         "pkg-0.0.1-cp311-cp311-macosx_10_9_x86_64.whl",
     )
-    got = _select_whl(whls = got, want_platform = "osx_x86_64")
-    _match(env, got, "pkg-0.0.1-cp311-cp311-macosx_10_9_x86_64.whl")
 
     got = _select_whls(whls = WHL_LIST, want_abis = ["cp311"], want_platforms = ["osx_aarch64"], want_python_version = "3.11")
     _match(
@@ -257,8 +246,6 @@
         "pkg-0.0.1-cp311-cp311-macosx_10_9_universal2.whl",
         "pkg-0.0.1-cp311-cp311-macosx_11_0_arm64.whl",
     )
-    got = _select_whl(whls = got, want_platform = "osx_aarch64")
-    _match(env, got, "pkg-0.0.1-cp311-cp311-macosx_11_0_arm64.whl")
 
 _tests.append(_test_osx_prefer_arch_specific)
 
@@ -270,8 +257,6 @@
         got,
         "pkg-0.0.1-cp311-cp311-macosx_10_9_universal2.whl",
     )
-    got = _select_whl(whls = got, want_platform = "osx_aarch64")
-    _match(env, got, "pkg-0.0.1-cp311-cp311-macosx_10_9_universal2.whl")
 
 _tests.append(_test_osx_fallback_to_universal2)
 
@@ -286,8 +271,6 @@
         "pkg-0.0.1-cp39-abi3-any.whl",
         "pkg-0.0.1-py3-none-any.whl",
     )
-    got = _select_whl(whls = got, want_platform = "linux_x86_64")
-    _match(env, got, "pkg-0.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl")
 
 _tests.append(_test_prefer_manylinux_wheels)