Skip to content

Commit

Permalink
Only add extensions in module file if there are extensions
Browse files Browse the repository at this point in the history
This fixes easybuilders#4330.
  • Loading branch information
wpoely86 committed Aug 30, 2023
1 parent ac91659 commit f725ac2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion easybuild/tools/module_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,8 @@ def _generate_extensions_list(self):
"""
Generate a list of all extensions in name/version format
"""
return self.app.make_extension_string(name_version_sep='/', ext_sep=',').split(',')
exts_str = self.app.make_extension_string(name_version_sep='/', ext_sep=',')
return exts_str.split(',') if exts_str else []

def _generate_help_text(self):
"""
Expand Down
10 changes: 10 additions & 0 deletions test/framework/module_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,16 @@ def test_module_extensions(self):
regex = re.compile(pattern, re.M)
self.assertTrue(regex.search(desc), "Pattern '%s' found in: %s" % (regex.pattern, desc))

# check if the extensions is missing if there are no extensions
test_ec = os.path.join(test_dir, 'easyconfigs', 'test_ecs', 't', 'toy', 'toy-0.0-test.eb')

ec = EasyConfig(test_ec)
eb = EasyBlock(ec)
modgen = self.MODULE_GENERATOR_CLASS(eb)
desc = modgen.get_description()

self.assertFalse(re.search(r"\s*extensions\(", desc), "No extensions found in: %s" % desc)

def test_prepend_paths(self):
"""Test generating prepend-paths statements."""
# test prepend_paths
Expand Down

0 comments on commit f725ac2

Please sign in to comment.