-
Notifications
You must be signed in to change notification settings - Fork 284
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
add support for running 'pip check' during sanity check in generic PythonPackage easyblock #1853
Conversation
@@ -177,6 +177,24 @@ def det_pylibdir(plat_specific=False, python_cmd=None): | |||
return pylibdir | |||
|
|||
|
|||
def det_pip_version(): |
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.
I'd refactor this to only do the required work:
def det_pip_version():
"""Determine version of currently active 'pip' command."""
out, _ = run_cmd("pip --version", verbose=False, simple=False, trace=False)
pip_version_regex = re.compile('^pip ([0-9.]+)')
res = pip_version_regex.search(out)
if res:
return res.group(1)
else:
log = fancylogger.getLogger('det_pylibdir', fname=False)
log.warning("Failed to determine pip version from '%s' using pattern '%s'", out, pip_version_regex.pattern)
return None
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.
I'll enhance the function a bit to use more logging instead...
pip_version = det_pip_version() | ||
if pip_version: | ||
if LooseVersion(pip_version) >= LooseVersion('9.0.0'): | ||
run_cmd("pip check") |
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.
this is non - fatal if it fails?
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.
It's fatal, run_cmd
will raise an error for commands that exit with a non-zero exit code by default.
cc @Flamefire