Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch req.link = None #5951

Merged
merged 3 commits into from
Sep 29, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pipenv/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,8 @@ def is_satisfied(self, req: InstallRequirement):
None,
)
if match is not None:
if req.link is None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial thoughts, I am wondering if this should actually return True since there was a match -- alternatively, we might handle this on line 780/782: elif req.link and match.has_metadata("direct_url.json")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then we check on 772, 780 and 797 the boolean value of req.link, which could be done once before and the cut out from there. Maybe that is a style choice.

My idea was that if we can not properly compary e.g. that from

return (
    vcs_type == req.link.scheme
    and vcs_ref == requested_revision
    and direct_url_metadata["url"]
    == pipfile_part[req.link.scheme]
)

I would assume that expected behavour for not being able to make the comparison to req.link.scheme should default to False.

But yes, thinking about it, it makes more sense to return True, as after the if statements True is also returned by default.

return False
if req.editable and req.link and req.link.is_file:
requested_path = req.link.file_path
if os.path.exists(requested_path):
Expand Down