Skip to content

Commit 840b346

Browse files
rebase against source
1 parent 12870fa commit 840b346

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/pip/_internal/req/req_install.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,17 @@ def __init__(
190190

191191
@property
192192
def req(self) -> Optional[Requirement]:
193-
"""Calculate a requirement from the cached dist if necessary."""
193+
"""Calculate a requirement from the cached dist, if populated.
194+
195+
The cached dist can be populated by either
196+
``self.cache_virtual_metadata_only_dist()`` or
197+
``self.cache_concrete_dist()`` and can also be retrieved with
198+
``self.get_dist()``."""
194199
if self._req is not None:
195200
return self._req
196-
if self._cached_dist is not None:
197-
name = self._cached_dist.canonical_name
198-
version = str(self._cached_dist.version)
201+
if self._dist is not None:
202+
name = self._dist.canonical_name
203+
version = str(self._dist.version)
199204
self._req = Requirement(f"{name}=={version}")
200205
return self._req
201206
return None

0 commit comments

Comments
 (0)