Skip to content
Merged
14 changes: 12 additions & 2 deletions easybuild/tools/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,11 +555,21 @@ def mod_exists_via_show(mod_name):
# - Check first non-whitespace line for something that looks like an absolute path terminated by a colon
mod_exists_regex = r'\s*/.+:\s*'
for line in stderr.split('\n'):
# skip whitespace lines
self.log.debug("Checking line '%s' to determine whether %s exists...", line)
if OUTPUT_MATCHES['whitespace'].search(line):
self.log.debug("Treating line '%s' as whitespace, so skipping it", line)
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.

isn't this overly verbose, even for debugging?

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 helped a lot with figuring out the problem reported in #3376, so no.

continue
if OUTPUT_MATCHES['error'].search(line):
# skip lines that start with 'module-version',
# see https://github.com/easybuilders/easybuild-framework/issues/3376
elif line.startswith('module-version '):
Comment thread
boegel marked this conversation as resolved.
Outdated
self.log.debug("Skipping line '%s' since it starts with 'module-version'", line)
Comment thread
boegel marked this conversation as resolved.
Outdated
continue
# if any errors occured, conclude that module doesn't exist
elif OUTPUT_MATCHES['error'].search(line):
break
if re.match(mod_exists_regex, line):
# if line matches pattern that indicates an existing module file, the module file exists
elif re.match(mod_exists_regex, line):
res = True
break
return res
Expand Down