Skip to content

Commit c282680

Browse files
authored
Merge pull request #5555 from pypa/fix-5536
Fix duplicate egg name when adding extras for package install from url
2 parents cff5620 + 836e106 commit c282680

File tree

5 files changed

+30
-3
lines changed

5 files changed

+30
-3
lines changed

news/5536.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix for resolution error when direct url includes an extras.

pipenv/vendor/requirementslib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from .models.pipfile import Pipfile
66
from .models.requirements import Requirement
77

8-
__version__ = "2.2.2"
8+
__version__ = "2.2.3"
99

1010

1111
logger = logging.getLogger(__name__)

pipenv/vendor/requirementslib/models/requirements.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1831,7 +1831,7 @@ def from_pipfile(cls, name, pipfile):
18311831
line = "{0}&subdirectory={1}".format(line, pipfile["subdirectory"])
18321832
if editable:
18331833
line = "-e {0}".format(line)
1834-
arg_dict["parsed_line"] = Line(line)
1834+
arg_dict["parsed_line"] = Line(line, extras=extras)
18351835
arg_dict["setup_info"] = arg_dict["parsed_line"].setup_info
18361836
return cls(**arg_dict) # type: ignore
18371837

@@ -2525,6 +2525,8 @@ def get_line_instance(self):
25252525
self.is_file_or_url
25262526
and not local_editable
25272527
and not self.req.get_uri().startswith("file://")
2528+
# fix for file uri with egg names and extras
2529+
and not len(self.req.line_part.split("#")) > 1
25282530
):
25292531
line_parts.append(f"#egg={self._name}{self.extras_as_pip}")
25302532
else:

pipenv/vendor/vendor.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ptyprocess==0.7.0
1212
pyparsing==3.0.9
1313
python-dotenv==0.19.0
1414
pythonfinder==1.3.1
15-
requirementslib==2.2.2
15+
requirementslib==2.2.3
1616
ruamel.yaml==0.17.21
1717
shellingham==1.5.0
1818
toml==0.10.2
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import os
2+
import pytest
3+
4+
@pytest.mark.urls
5+
@pytest.mark.extras
6+
@pytest.mark.install
7+
def test_install_uri_with_extras(pipenv_instance_private_pypi):
8+
file_uri = "http://localhost:8080/packages/plette/plette-0.2.2-py2.py3-none-any.whl"
9+
index = os.environ['PIPENV_TEST_INDEX']
10+
with pipenv_instance_private_pypi() as p:
11+
with open(p.pipfile_path, 'w') as f:
12+
contents = """
13+
[[source]]
14+
url = "{index}"
15+
verify_ssl = false
16+
name = "testindex"
17+
18+
[packages]
19+
plette = {{file = "{file_uri}", extras = ["validation"]}}
20+
""".format(file_uri=file_uri, index=index)
21+
f.write(contents)
22+
c = p.pipenv("install")
23+
assert c.returncode == 0
24+
assert "plette" in p.lockfile["default"]

0 commit comments

Comments
 (0)