Skip to content

Commit cf868b7

Browse files
rebase against source
1 parent 3e4839a commit cf868b7

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
@@ -192,12 +192,17 @@ def __init__(
192192

193193
@property
194194
def req(self) -> Optional[Requirement]:
195-
"""Calculate a requirement from the cached dist if necessary."""
195+
"""Calculate a requirement from the cached dist, if populated.
196+
197+
The cached dist can be populated by either
198+
``self.cache_virtual_metadata_only_dist()`` or
199+
``self.cache_concrete_dist()`` and can also be retrieved with
200+
``self.get_dist()``."""
196201
if self._req is not None:
197202
return self._req
198-
if self._cached_dist is not None:
199-
name = self._cached_dist.canonical_name
200-
version = str(self._cached_dist.version)
203+
if self._dist is not None:
204+
name = self._dist.canonical_name
205+
version = str(self._dist.version)
201206
self._req = Requirement(f"{name}=={version}")
202207
return self._req
203208
return None

0 commit comments

Comments
 (0)