Skip to content

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

Merged
wpoely86 merged 5 commits intoeasybuilders:developfrom
boegel:pip_check_pypkg
Nov 21, 2019
Merged

add support for running 'pip check' during sanity check in generic PythonPackage easyblock#1853
wpoely86 merged 5 commits intoeasybuilders:developfrom
boegel:pip_check_pypkg

Conversation

@boegel
Copy link
Copy Markdown
Member

@boegel boegel commented Nov 15, 2019

@boegel boegel added this to the next release (4.1.0) milestone Nov 15, 2019
Comment thread easybuild/easyblocks/generic/pythonpackage.py
Comment thread easybuild/easyblocks/generic/pythonpackage.py Outdated
return pylibdir


def det_pip_version():
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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