Skip to content

Commit ca2527e

Browse files
committed
fully move the parsing of Requires-Dist to starlark
1 parent fe5d7fc commit ca2527e

File tree

8 files changed

+41
-618
lines changed

8 files changed

+41
-618
lines changed

MODULE.bazel.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

python/private/pypi/pep508_req.bzl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
load("//python/private:normalize_name.bzl", "normalize_name")
1919

20+
_STRIP = ["(", " ", ">", "=", "<", "~", "!"]
21+
2022
def requirement(spec):
2123
"""Parse a PEP508 requirement line
2224
@@ -29,8 +31,8 @@ def requirement(spec):
2931
requires, _, maybe_hashes = spec.partition(";")
3032
marker, _, _ = maybe_hashes.partition("--hash")
3133
requires, _, extras_unparsed = requires.partition("[")
32-
requires, _, _ = requires.partition("(")
33-
requires, _, _ = requires.partition(" ")
34+
for char in _STRIP:
35+
requires, _, _ = requires.partition(char)
3436
extras = extras_unparsed.strip("]").split(",")
3537

3638
return struct(

python/private/pypi/whl_installer/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ py_library(
66
srcs = [
77
"arguments.py",
88
"namespace_pkgs.py",
9-
"platform.py",
109
"wheel.py",
1110
"wheel_installer.py",
1211
],

python/private/pypi/whl_installer/arguments.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
import pathlib
1818
from typing import Any, Dict, Set
1919

20-
from python.private.pypi.whl_installer.platform import Platform
21-
2220

2321
def parser(**kwargs: Any) -> argparse.ArgumentParser:
2422
"""Create a parser for the wheel_installer tool."""
@@ -41,12 +39,6 @@ def parser(**kwargs: Any) -> argparse.ArgumentParser:
4139
action="store",
4240
help="Extra arguments to pass down to pip.",
4341
)
44-
parser.add_argument(
45-
"--platform",
46-
action="extend",
47-
type=Platform.from_string,
48-
help="Platforms to target dependencies. Can be used multiple times.",
49-
)
5042
parser.add_argument(
5143
"--pip_data_exclude",
5244
action="store",

python/private/pypi/whl_installer/platform.py

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

0 commit comments

Comments
 (0)