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

add support for running 'pip check' during sanity check in generic PythonPackage easyblock #1853

Merged
merged 5 commits into from
Nov 21, 2019

Conversation

boegel
Copy link
Member

@boegel boegel commented Nov 15, 2019

@boegel boegel added this to the next release (4.1.0) milestone Nov 15, 2019
@@ -177,6 +177,24 @@ def det_pylibdir(plat_specific=False, python_cmd=None):
return pylibdir


def det_pip_version():
Copy link
Contributor

@Flamefire Flamefire Nov 16, 2019

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

Copy link
Member Author

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")
Copy link
Member

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?

Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants