Skip to content

Commit

Permalink
rebase against source
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmicexplorer committed Jan 11, 2024
1 parent 3e4839a commit cf868b7
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/pip/_internal/req/req_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,17 @@ def __init__(

@property
def req(self) -> Optional[Requirement]:
"""Calculate a requirement from the cached dist if necessary."""
"""Calculate a requirement from the cached dist, if populated.
The cached dist can be populated by either
``self.cache_virtual_metadata_only_dist()`` or
``self.cache_concrete_dist()`` and can also be retrieved with
``self.get_dist()``."""
if self._req is not None:
return self._req
if self._cached_dist is not None:
name = self._cached_dist.canonical_name
version = str(self._cached_dist.version)
if self._dist is not None:
name = self._dist.canonical_name
version = str(self._dist.version)
self._req = Requirement(f"{name}=={version}")
return self._req
return None
Expand Down

0 comments on commit cf868b7

Please sign in to comment.