Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion easybuild/framework/easystack.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ def __init__(self, name, version, versionsuffix, toolchain_version, toolchain_na
class EasyStackParser(object):
"""Parser for easystack files (in YAML syntax)."""

@only_if_module_is_available('yaml', pkgname='PyYAML')
@staticmethod
def parse(filepath):
"""Parses YAML file and assigns obtained values to SW config instances as well as general config instance"""
Expand Down Expand Up @@ -211,6 +210,7 @@ def parse(filepath):
return easystack


@only_if_module_is_available('yaml', pkgname='PyYAML')
def parse_easystack(filepath):
"""Parses through easystack file, returns what EC are to be installed together with their options."""
log_msg = "Support for easybuild-ing from multiple easyconfigs based on "
Expand Down
10 changes: 5 additions & 5 deletions easybuild/tools/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,18 +173,18 @@ def wrap(orig):
pass

if imported is None:
raise ImportError("None of the specified modules (%s) is available" % ', '.join(modnames))
raise ImportError
else:
return orig

except ImportError as err:
# need to pass down 'err' via named argument to ensure it's in scope when using Python 3.x
def error(err=err, *args, **kwargs):
msg = "%s; required module '%s' is not available" % (err, modname)
except ImportError:
def error(*args, **kwargs):
msg = "None of the specified modules (%s) is available" % ', '.join(modnames)
if pkgname:
msg += " (provided by Python package %s, available from %s)" % (pkgname, url)
elif url:
msg += " (available from %s)" % url
msg += ", yet one of them is required!"
raise EasyBuildError("ImportError: %s", msg)
return error

Expand Down
6 changes: 4 additions & 2 deletions test/framework/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ def foo2():
def bar():
pass

err_pat = "required module 'nosuchmoduleoutthere' is not available.*package nosuchpkg.*pypi/nosuchpkg"
err_pat = r"None of the specified modules \(nosuchmoduleoutthere\) is available.*"
err_pat += r"package nosuchpkg.*pypi/nosuchpkg"
self.assertErrorRegex(EasyBuildError, err_pat, bar)

@only_if_module_is_available(('nosuchmodule', 'anothernosuchmodule'))
Expand All @@ -96,7 +97,8 @@ class Foo():
def foobar(self):
pass

err_pat = r"required module 'thisdoesnotexist' is not available \(available from http://example.com\)"
err_pat = r"None of the specified modules \(thisdoesnotexist\) is available "
err_pat += r"\(available from http://example.com\)"
self.assertErrorRegex(EasyBuildError, err_pat, Foo().foobar)

def test_docstrings(self):
Expand Down