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

Using pip or packaging for wildcard version matching #465

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

mkb79
Copy link
Contributor

@mkb79 mkb79 commented Jan 21, 2023

With these changes wildcard versions lile '==1.*' can be matched.

IMPORTANT: packaging or pip must be installed for this.

`packaging` or `pip` must be installed for this.

With these changes wildcard versions lile '==1.*' can be matched.
lib/libversion.py Outdated Show resolved Hide resolved
if HAS_SPECIFIER:
try:
self.specifier = SpecifierSet(''.join(version_specs[0]))
except:
Copy link
Collaborator

@cclauss cclauss Jan 30, 2023

Choose a reason for hiding this comment

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

Do not use bare except:, it also catches unexpected events like memory errors, interrupts, system exit, and so on.

lib/libversion.py Outdated Show resolved Hide resolved
if self.specifier is not None:
try:
return self.specifier.contains(version)
except:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do not use bare except:

@@ -360,4 +399,4 @@ def match(self, version):
else:
if not op(vi, evi):
matches = False
return matches
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add a blank line at the end of the file (as discussed in PEP8) to avoid the ⛔ below in the GitHub file viewer.

lib/libversion.py Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants