-
Notifications
You must be signed in to change notification settings - Fork 230
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
base: dev
Are you sure you want to change the base?
Conversation
`packaging` or `pip` must be installed for this. With these changes wildcard versions lile '==1.*' can be matched.
if HAS_SPECIFIER: | ||
try: | ||
self.specifier = SpecifierSet(''.join(version_specs[0])) | ||
except: |
There was a problem hiding this comment.
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.
if self.specifier is not None: | ||
try: | ||
return self.specifier.contains(version) | ||
except: |
There was a problem hiding this comment.
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:
lib/libversion.py
Outdated
@@ -360,4 +399,4 @@ def match(self, version): | |||
else: | |||
if not op(vi, evi): | |||
matches = False | |||
return matches |
There was a problem hiding this comment.
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.
With these changes wildcard versions lile '==1.*' can be matched.
IMPORTANT:
packaging
orpip
must be installed for this.