diff --git a/pipenv/environment.py b/pipenv/environment.py index 26b42e66d2..26975ce0dc 100644 --- a/pipenv/environment.py +++ b/pipenv/environment.py @@ -769,7 +769,13 @@ def is_satisfied(self, req: InstallRequirement): None, ) if match is not None: - if req.editable and req.link and req.link.is_file: + if req.specifier is not None: + return SpecifierSet(str(req.specifier)).contains( + match.version, prereleases=True + ) + if req.link is None: + return True + elif req.editable and req.link.is_file: requested_path = req.link.file_path if os.path.exists(requested_path): local_path = requested_path @@ -794,12 +800,8 @@ def is_satisfied(self, req: InstallRequirement): and vcs_ref == requested_revision and direct_url_metadata["url"] == pipfile_part[req.link.scheme] ) - elif req.link and req.link.is_vcs: + elif req.link.is_vcs: return False - elif req.specifier is not None: - return SpecifierSet(str(req.specifier)).contains( - match.version, prereleases=True - ) return True return False