Skip to content

Commit 1e3c66e

Browse files
authored
Merge pull request #13523 from mtsokol/fix-rstrip
Add `rstrip` in `def _strip_extras`
2 parents 0a62b4a + 04192bb commit 1e3c66e

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

news/13523.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Permit spaces between a filepath and extras in an install requirement.

src/pip/_internal/req/constructors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def _strip_extras(path: str) -> tuple[str, str | None]:
4747
m = re.match(r"^(.+)(\[[^\]]+\])$", path)
4848
extras = None
4949
if m:
50-
path_no_extras = m.group(1)
50+
path_no_extras = m.group(1).rstrip()
5151
extras = m.group(2)
5252
else:
5353
path_no_extras = path

tests/unit/test_req.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,7 @@ def test_requirement_file(self) -> None:
768768
("pkg [ext] == 1.0; python_version<='3.6'", "pkg==1.0"),
769769
("pkg-all.allowed_chars0 ~= 2.0", "pkg-all.allowed_chars0~=2.0"),
770770
("pkg-all.allowed_chars0 [ext] ~= 2.0", "pkg-all.allowed_chars0~=2.0"),
771+
("simple-0.1-py2.py3-none-any.whl [ext]", "simple==0.1"),
771772
],
772773
)
773774
def test_install_req_drop_extras(self, inp: str, out: str) -> None:

0 commit comments

Comments
 (0)