diff --git a/easybuild/framework/easyconfig/default.py b/easybuild/framework/easyconfig/default.py index bdb6f1312c..206dd7ec5c 100644 --- a/easybuild/framework/easyconfig/default.py +++ b/easybuild/framework/easyconfig/default.py @@ -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 ' diff --git a/easybuild/framework/easyconfig/easyconfig.py b/easybuild/framework/easyconfig/easyconfig.py index 5be37a8917..30039a4c52 100644 --- a/easybuild/framework/easyconfig/easyconfig.py +++ b/easybuild/framework/easyconfig/easyconfig.py @@ -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 @@ -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 diff --git a/easybuild/tools/options.py b/easybuild/tools/options.py index 185008289f..baf13e7e7f 100644 --- a/easybuild/tools/options.py +++ b/easybuild/tools/options.py @@ -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)", diff --git a/test/framework/toy_build.py b/test/framework/toy_build.py index ec1cdd8559..e4ea42f4b1 100644 --- a/test/framework/toy_build.py +++ b/test/framework/toy_build.py @@ -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 @@ -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"