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

raise EasyBuildError rather than ImportError in only_if_module_is_available decorator #1662

Merged
merged 1 commit into from
Mar 10, 2016

Conversation

boegel
Copy link
Member

@boegel boegel commented Mar 9, 2016

This ensures cleaner error messages in case a required Python package is not available, cfr. easybuilders/easybuild-easyconfigs#2670:

Now:

== temporary log file in case of crash /tmp/eb-uts8ZU/easybuild-nm6hF1.log
ERROR: No module named git; required module 'git' is not available (provided by Python package GitPython, available from https://pypi.python.org/pypi/GitPython)

was:

== temporary log file in case of crash /tmp/eb-3ioxWD/easybuild-oeMsuZ.log
Traceback (most recent call last):
  File "/home/adam/.local/easybuild/software/Python/2.7.10-foss-2015b/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/home/adam/.local/easybuild/software/Python/2.7.10-foss-2015b/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/adam/.local/easybuild/software/EasyBuild/2.6.0/lib/python2.7/site-packages/easybuild_framework-2.6.0-py2.7.egg/easybuild/main.py", line 381, in <module>
    main()
  File "/home/adam/.local/easybuild/software/EasyBuild/2.6.0/lib/python2.7/site-packages/easybuild_framework-2.6.0-py2.7.egg/easybuild/main.py", line 248, in main
    new_pr(orig_paths, title=options.pr_title, descr=options.pr_descr, commit_msg=options.pr_commit_msg)
  File "/home/adam/.local/easybuild/software/EasyBuild/2.6.0/lib/python2.7/site-packages/easybuild_framework-2.6.0-py2.7.egg/easybuild/tools/utilities.py", line 145, in error
    raise ImportError(msg)
ImportError: 'gitdb' could not be found in your PYTHONPATH; required module 'git' is not available (provided by Python package GitPython, available from https://pypi.python.org/pypi/GitPython)

cc @verdurin

@hpcugentbot
Copy link
Contributor

EasyBuild framework unit test suite PASSed (see https://jenkins1.ugent.be/job/easybuild-framework-pr-builder/2850/console for more details).

This pull request is now ready for review/testing.

Please try and find someone who can tackle this; contact @boegel if you're not sure what to do.

@boegel
Copy link
Member Author

boegel commented Mar 9, 2016

@wpoely86: please review?

@wpoely86
Copy link
Member

👍

@boegel
Copy link
Member Author

boegel commented Mar 10, 2016

Thanks for the review @wpoely86!

boegel added a commit that referenced this pull request Mar 10, 2016
raise EasyBuildError rather than ImportError in only_if_module_is_available decorator
@boegel boegel merged commit 3694b0d into easybuilders:develop Mar 10, 2016
@boegel boegel deleted the raise_eberror_not_importerror branch March 10, 2016 10:50
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.

3 participants