From 06b6d91bfb0e47f2f85f5aa0671aa9e928edaf4d Mon Sep 17 00:00:00 2001 From: frostming Date: Fri, 28 Aug 2020 11:25:46 +0800 Subject: [PATCH] Fill ireq.req with simple named requirement --- news/264.bugfix.rst | 1 + src/requirementslib/models/requirements.py | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 news/264.bugfix.rst diff --git a/news/264.bugfix.rst b/news/264.bugfix.rst new file mode 100644 index 00000000..1a59816d --- /dev/null +++ b/news/264.bugfix.rst @@ -0,0 +1 @@ +Fix a bug that non-wheel file requirements always fail on ``InstallRequirement.check_if_exists()``. diff --git a/src/requirementslib/models/requirements.py b/src/requirementslib/models/requirements.py index 5edc4846..7effd942 100644 --- a/src/requirementslib/models/requirements.py +++ b/src/requirementslib/models/requirements.py @@ -939,8 +939,10 @@ def parse_ireq(self): # type: () -> None if self._ireq is None: self._ireq = self.get_ireq() - if self._ireq is not None: - if self.requirement is not None and self._ireq.req is None: + if self._ireq is not None and self._ireq.req is None: + if self.is_file or self.is_remote_url: + self._ireq.req = PackagingRequirement(self.name) + elif self.requirement is not None: self._ireq.req = self.requirement def _parse_wheel(self):