From 20ed685c660f6c5e5bc2f711dfaa1e8d94015220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Sun, 10 Jul 2022 19:27:55 +0200 Subject: [PATCH] Add requested property to BaseDistribution --- src/pip/_internal/metadata/base.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/pip/_internal/metadata/base.py b/src/pip/_internal/metadata/base.py index 10a6c489783..465ff791bfb 100644 --- a/src/pip/_internal/metadata/base.py +++ b/src/pip/_internal/metadata/base.py @@ -311,6 +311,15 @@ def installer(self) -> str: return cleaned_line return "" + @property + def requested(self) -> bool: + try: + self.read_text("REQUESTED") + except (OSError, ValueError, NoneMetadataError): + return False + else: + return True + @property def editable(self) -> bool: return bool(self.editable_project_location)