Skip to content

Commit 5387661

Browse files
committed
remove dead code
1 parent 04f320b commit 5387661

4 files changed

Lines changed: 1 addition & 161 deletions

File tree

python/private/pypi/whl_installer/arguments.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,6 @@ def parser(**kwargs: Any) -> argparse.ArgumentParser:
5555
help="Use 'pip download' instead of 'pip wheel'. Disables building wheels from source, but allows use of "
5656
"--platform, --python-version, --implementation, and --abi in --extra_pip_args.",
5757
)
58-
parser.add_argument(
59-
"--whl-file",
60-
type=pathlib.Path,
61-
help="Extract a whl file to be used within Bazel.",
62-
)
6358
return parser
6459

6560

python/private/pypi/whl_installer/wheel.py

Lines changed: 0 additions & 105 deletions
This file was deleted.

python/private/pypi/whl_installer/wheel_installer.py

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@
2525
from tempfile import NamedTemporaryFile
2626
from typing import Dict, List, Optional, Set, Tuple
2727

28-
from pip._vendor.packaging.utils import canonicalize_name
29-
30-
from python.private.pypi.whl_installer import arguments, wheel
28+
from python.private.pypi.whl_installer import arguments
3129

3230

3331
def _configure_reproducible_wheels() -> None:
@@ -55,44 +53,8 @@ def _configure_reproducible_wheels() -> None:
5553
os.environ["PYTHONHASHSEED"] = "0"
5654

5755

58-
def _parse_requirement_for_extra(
59-
requirement: str,
60-
) -> Tuple[Optional[str], Optional[Set[str]]]:
61-
"""Given a requirement string, returns the requirement name and set of extras, if extras specified.
62-
Else, returns (None, None)
63-
"""
64-
65-
# https://www.python.org/dev/peps/pep-0508/#grammar
66-
extras_pattern = re.compile(
67-
r"^\s*([0-9A-Za-z][0-9A-Za-z_.\-]*)\s*\[\s*([0-9A-Za-z][0-9A-Za-z_.\-]*(?:\s*,\s*[0-9A-Za-z][0-9A-Za-z_.\-]*)*)\s*\]"
68-
)
69-
70-
matches = extras_pattern.match(requirement)
71-
if matches:
72-
return (
73-
canonicalize_name(matches.group(1)),
74-
{extra.strip() for extra in matches.group(2).split(",")},
75-
)
76-
77-
return None, None
7856

7957

80-
def _extract_wheel(
81-
wheel_file: str,
82-
extras: Dict[str, Set[str]],
83-
installation_dir: Path = Path("."),
84-
) -> None:
85-
"""Extracts wheel into given directory and creates py_library and filegroup targets.
86-
87-
Args:
88-
wheel_file: the filepath of the .whl
89-
installation_dir: the destination directory for installation of the wheel.
90-
extras: a list of extras to add as dependencies for the installed wheel
91-
"""
92-
93-
whl = wheel.Wheel(wheel_file)
94-
whl.unzip(installation_dir)
95-
9658

9759
def main() -> None:
9860
args = arguments.parser(description=__doc__).parse_args()
@@ -101,17 +63,6 @@ def main() -> None:
10163

10264
_configure_reproducible_wheels()
10365

104-
if args.whl_file:
105-
whl = Path(args.whl_file)
106-
107-
name, extras_for_pkg = _parse_requirement_for_extra(args.requirement)
108-
extras = {name: extras_for_pkg} if extras_for_pkg and name else dict()
109-
_extract_wheel(
110-
wheel_file=whl,
111-
extras=extras,
112-
)
113-
return
114-
11566
pip_args = (
11667
[sys.executable, "-m", "pip"]
11768
+ (["--isolated"] if args.isolated else [])

python/private/pypi/whl_library.bzl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,6 @@ way to define whl_library and move whl patching to a separate place. INTERNAL US
603603
"_python_srcs": attr.label_list(
604604
# Used as a default value in a rule to ensure we fetch the dependencies.
605605
default = [
606-
Label("//python/private/pypi/whl_installer:wheel.py"),
607606
Label("//python/private/pypi/whl_installer:wheel_installer.py"),
608607
Label("//python/private/pypi/whl_installer:arguments.py"),
609608
] + record_files.values(),

0 commit comments

Comments
 (0)