From 5d9a56a543eb7f8e078d6aa737077cfc23be40ed Mon Sep 17 00:00:00 2001 From: Markus Geimer Date: Thu, 7 Jul 2016 17:04:59 +0200 Subject: [PATCH 1/5] Add support for 'hidden=True' easyconfig parameter --- easybuild/framework/easyconfig/default.py | 1 + easybuild/framework/easyconfig/easyconfig.py | 2 +- test/framework/toy_build.py | 23 ++++++++++++++++++-- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/easybuild/framework/easyconfig/default.py b/easybuild/framework/easyconfig/default.py index bdb6f1312c..dd57e49078 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 name 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 b2256a2cbe..8710c6aa3e 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 diff --git a/test/framework/toy_build.py b/test/framework/toy_build.py index 23e2d433a3..e53ecbe058 100644 --- a/test/framework/toy_build.py +++ b/test/framework/toy_build.py @@ -728,8 +728,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 @@ -741,6 +741,25 @@ 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.""" + tmpdir = tempfile.mkdtemp() + # copy toy easyconfig file, and 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, tmpdir) + ec_file = os.path.join(tmpdir, '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)) + shutil.rmtree(tmpdir) + def test_module_filepath_tweaking(self): """Test using --suffix-modules-path.""" mns_path = "easybuild.tools.module_naming_scheme.test_module_naming_scheme" From f585bb4c2154938d1c351928d2f976460bf34249 Mon Sep 17 00:00:00 2001 From: Markus Geimer Date: Fri, 8 Jul 2016 08:55:12 +0200 Subject: [PATCH 2/5] Fix typo --- test/framework/toy_build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/framework/toy_build.py b/test/framework/toy_build.py index e53ecbe058..adb7c932a1 100644 --- a/test/framework/toy_build.py +++ b/test/framework/toy_build.py @@ -744,7 +744,7 @@ def test_toy_hidden_cmdline(self): def test_toy_hidden_easyconfig(self): """Test installing a hidden module using the 'hidden = True' easyconfig parameter.""" tmpdir = tempfile.mkdtemp() - # copy toy easyconfig file, and hiding option to it + # 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, tmpdir) ec_file = os.path.join(tmpdir, 'toy-0.0.eb') From 3f5feca3af414c2fad26a6a22b0094db072ec5d0 Mon Sep 17 00:00:00 2001 From: Markus Geimer Date: Mon, 11 Jul 2016 10:19:49 +0200 Subject: [PATCH 3/5] Respect parsed 'hidden' easyconfig parameter --- easybuild/framework/easyconfig/easyconfig.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easybuild/framework/easyconfig/easyconfig.py b/easybuild/framework/easyconfig/easyconfig.py index 8710c6aa3e..b6d38e6e7b 100644 --- a/easybuild/framework/easyconfig/easyconfig.py +++ b/easybuild/framework/easyconfig/easyconfig.py @@ -1227,7 +1227,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 From 54a838766d0d3567f7384560a17d0a9f9b0c6740 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Thu, 4 Aug 2016 16:00:16 +0200 Subject: [PATCH 4/5] correct help message for --hidden and 'hidden' easyconfig parameter --- easybuild/framework/easyconfig/default.py | 2 +- easybuild/tools/options.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/easybuild/framework/easyconfig/default.py b/easybuild/framework/easyconfig/default.py index dd57e49078..206dd7ec5c 100644 --- a/easybuild/framework/easyconfig/default.py +++ b/easybuild/framework/easyconfig/default.py @@ -88,7 +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 name with '.'", 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/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)", From 27dc92ab244a13f9b56addc7b912807049bd6c76 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Thu, 4 Aug 2016 16:05:35 +0200 Subject: [PATCH 5/5] use self.test_prefix in test for hidden easyconfig parameter --- test/framework/toy_build.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/framework/toy_build.py b/test/framework/toy_build.py index adb7c932a1..cd65965717 100644 --- a/test/framework/toy_build.py +++ b/test/framework/toy_build.py @@ -743,11 +743,10 @@ def test_toy_hidden_cmdline(self): def test_toy_hidden_easyconfig(self): """Test installing a hidden module using the 'hidden = True' easyconfig parameter.""" - tmpdir = tempfile.mkdtemp() # 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, tmpdir) - ec_file = os.path.join(tmpdir, '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 @@ -758,7 +757,6 @@ def test_toy_hidden_easyconfig(self): # installed software is not hidden toybin = os.path.join(self.test_installpath, 'software', 'toy', '0.0', 'bin', 'toy') self.assertTrue(os.path.exists(toybin)) - shutil.rmtree(tmpdir) def test_module_filepath_tweaking(self): """Test using --suffix-modules-path."""