Skip to content

Commit

Permalink
Merge pull request #1837 from geimer/hidden_easyconfig
Browse files Browse the repository at this point in the history
Add support for 'hidden=True' easyconfig parameter
  • Loading branch information
boegel authored Aug 4, 2016
2 parents f87558e + bbf2298 commit 50f81be
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
1 change: 1 addition & 0 deletions easybuild/framework/easyconfig/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
'easyblock': [None, "EasyBlock to use for building; if set to None, an easyblock is selected "
"based on the software name", BUILD],
'easybuild_version': [None, "EasyBuild-version this spec-file was written for", BUILD],
'hidden': [False, "Install module file as 'hidden' by prefixing its version with '.'", BUILD],
'installopts': ['', 'Extra options for installation', BUILD],
'maxparallel': [None, 'Max degree of parallelism', BUILD],
'parallel': [None, ('Degree of parallelism for e.g. make (default: based on the number of '
Expand Down
4 changes: 2 additions & 2 deletions easybuild/framework/easyconfig/easyconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def __init__(self, path, extra_options=None, build_specs=None, validate=True, hi

# keep track of whether the generated module file should be hidden
if hidden is None:
hidden = build_option('hidden')
hidden = self['hidden'] or build_option('hidden')
self.hidden = hidden

# set installdir/module info
Expand Down Expand Up @@ -1233,7 +1233,7 @@ def process_easyconfig(path, build_specs=None, validate=True, parse_only=False,
'dependencies': [],
'builddependencies': [],
'hiddendependencies': [],
'hidden': hidden,
'hidden': ec.hidden,
})
if len(blocks) > 1:
easyconfig['original_spec'] = path
Expand Down
2 changes: 1 addition & 1 deletion easybuild/tools/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def override_options(self):
'group': ("Group to be used for software installations (only verified, not set)", None, 'store', None),
'group-writable-installdir': ("Enable group write permissions on installation directory after installation",
None, 'store_true', False),
'hidden': ("Install 'hidden' module file(s) by prefixing their name with '.'", None, 'store_true', False),
'hidden': ("Install 'hidden' module file(s) by prefixing their version with '.'", None, 'store_true', False),
'ignore-osdeps': ("Ignore any listed OS dependencies", None, 'store_true', False),
'filter-deps': ("Comma separated list of dependencies that you DON'T want to install with EasyBuild, "
"because equivalent OS packages are installed. (e.g. --filter-deps=zlib,ncurses)",
Expand Down
21 changes: 19 additions & 2 deletions test/framework/toy_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,8 +730,8 @@ def test_toy_advanced(self):
test_ec = os.path.join(test_dir, 'easyconfigs', 'toy-0.0-gompi-1.3.12-test.eb')
self.test_toy_build(ec_file=test_ec, versionsuffix='-gompi-1.3.12-test')

def test_toy_hidden(self):
"""Test installing a hidden module."""
def test_toy_hidden_cmdline(self):
"""Test installing a hidden module using the '--hidden' command line option."""
ec_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'easyconfigs', 'toy-0.0.eb')
self.test_toy_build(ec_file=ec_file, extra_args=['--hidden'], verify=False)
# module file is hidden
Expand All @@ -743,6 +743,23 @@ def test_toy_hidden(self):
toybin = os.path.join(self.test_installpath, 'software', 'toy', '0.0', 'bin', 'toy')
self.assertTrue(os.path.exists(toybin))

def test_toy_hidden_easyconfig(self):
"""Test installing a hidden module using the 'hidden = True' easyconfig parameter."""
# copy toy easyconfig file, and add hiding option to it
ec_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'easyconfigs', 'toy-0.0.eb')
shutil.copy2(ec_file, self.test_prefix)
ec_file = os.path.join(self.test_prefix, 'toy-0.0.eb')
write_file(ec_file, "\nhidden = True\n", append=True)
self.test_toy_build(ec_file=ec_file, verify=False)
# module file is hidden
toy_module = os.path.join(self.test_installpath, 'modules', 'all', 'toy', '.0.0')
if get_module_syntax() == 'Lua':
toy_module += '.lua'
self.assertTrue(os.path.exists(toy_module), 'Found hidden module %s' % toy_module)
# installed software is not hidden
toybin = os.path.join(self.test_installpath, 'software', 'toy', '0.0', 'bin', 'toy')
self.assertTrue(os.path.exists(toybin))

def test_module_filepath_tweaking(self):
"""Test using --suffix-modules-path."""
mns_path = "easybuild.tools.module_naming_scheme.test_module_naming_scheme"
Expand Down

0 comments on commit 50f81be

Please sign in to comment.