diff --git a/easybuild/framework/easyconfig/easyconfig.py b/easybuild/framework/easyconfig/easyconfig.py index 90c9a9609d..349b067641 100644 --- a/easybuild/framework/easyconfig/easyconfig.py +++ b/easybuild/framework/easyconfig/easyconfig.py @@ -247,11 +247,6 @@ def det_subtoolchain_version(current_tc, subtoolchain_names, optional_toolchains # system toolchain: bottom of the hierarchy if is_system_toolchain(subtoolchain_name): add_system_to_minimal_toolchains = build_option('add_system_to_minimal_toolchains') - if not add_system_to_minimal_toolchains and build_option('add_dummy_to_minimal_toolchains'): - depr_msg = "Use --add-system-to-minimal-toolchains instead of --add-dummy-to-minimal-toolchains" - _log.deprecated(depr_msg, '5.0') - add_system_to_minimal_toolchains = True - system_subtoolchain = True if add_system_to_minimal_toolchains and not incl_capabilities: @@ -2483,8 +2478,6 @@ def copy_patch_files(patch_specs, target_dir): def fix_deprecated_easyconfigs(paths): """Fix use of deprecated functionality in easyconfigs at specified locations.""" - dummy_tc_regex = re.compile(r'^toolchain\s*=\s*{.*name.*dummy.*}', re.M) - easyconfig_paths = [] for path in paths: easyconfig_paths.extend(find_easyconfigs(path)) @@ -2497,11 +2490,6 @@ def fix_deprecated_easyconfigs(paths): fixed = False - # fix use of 'dummy' toolchain, use SYSTEM constant instead - if dummy_tc_regex.search(ectxt): - ectxt = dummy_tc_regex.sub("toolchain = SYSTEM", ectxt) - fixed = True - # fix use of local variables with a name other than a single letter or 'local_*' ec = EasyConfig(path, local_var_naming_check=LOCAL_VAR_NAMING_CHECK_LOG) for key in ec.unknown_keys: diff --git a/easybuild/toolchains/compiler/dummycompiler.py b/easybuild/toolchains/compiler/dummycompiler.py deleted file mode 100644 index 767dcb66c5..0000000000 --- a/easybuild/toolchains/compiler/dummycompiler.py +++ /dev/null @@ -1,50 +0,0 @@ -## -# Copyright 2012-2023 Ghent University -# -# This file is part of EasyBuild, -# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), -# with support of Ghent University (http://ugent.be/hpc), -# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be), -# Flemish Research Foundation (FWO) (http://www.fwo.be/en) -# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en). -# -# https://github.com/easybuilders/easybuild -# -# EasyBuild is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation v2. -# -# EasyBuild is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with EasyBuild. If not, see . -## -""" -Support for dummy compiler. - -Authors: - -* Stijn De Weirdt (Ghent University) -* Kenneth Hoste (Ghent University) -""" - -from easybuild.tools.toolchain.compiler import Compiler - - -TC_CONSTANT_DUMMY = "DUMMY" - - -class DummyCompiler(Compiler): - """Dummy compiler : try not to even use system gcc""" - COMPILER_MODULE_NAME = [] - COMPILER_FAMILY = TC_CONSTANT_DUMMY - - COMPILER_CC = '%sCC' % TC_CONSTANT_DUMMY - COMPILER_CXX = '%sCXX' % TC_CONSTANT_DUMMY - - COMPILER_F77 = '%sF77' % TC_CONSTANT_DUMMY - COMPILER_F90 = '%sF90' % TC_CONSTANT_DUMMY - COMPILER_FC = '%sFC' % TC_CONSTANT_DUMMY diff --git a/easybuild/toolchains/dummy.py b/easybuild/toolchains/dummy.py deleted file mode 100644 index cb2a988bd0..0000000000 --- a/easybuild/toolchains/dummy.py +++ /dev/null @@ -1,38 +0,0 @@ -## -# Copyright 2012-2023 Ghent University -# -# This file is part of EasyBuild, -# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), -# with support of Ghent University (http://ugent.be/hpc), -# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be), -# Flemish Research Foundation (FWO) (http://www.fwo.be/en) -# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en). -# -# https://github.com/easybuilders/easybuild -# -# EasyBuild is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation v2. -# -# EasyBuild is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with EasyBuild. If not, see . -## -""" -EasyBuild support for dummy compiler toolchain. - -Authors: - -* Kenneth Hoste (Ghent University) -""" - -from easybuild.toolchains.compiler.dummycompiler import DummyCompiler - - -class Dummy(DummyCompiler): - """Dummy toolchain.""" - NAME = 'dummy' diff --git a/easybuild/tools/config.py b/easybuild/tools/config.py index 88571ed37c..c573a59b9f 100644 --- a/easybuild/tools/config.py +++ b/easybuild/tools/config.py @@ -267,7 +267,6 @@ def mk_full_default_path(name, prefix=DEFAULT_PREFIX): 'zip_logs', ], False: [ - 'add_dummy_to_minimal_toolchains', 'add_system_to_minimal_toolchains', 'allow_modules_tool_mismatch', 'backup_patched_files', diff --git a/easybuild/tools/docs.py b/easybuild/tools/docs.py index 7e048d4529..cf43f66bad 100644 --- a/easybuild/tools/docs.py +++ b/easybuild/tools/docs.py @@ -61,7 +61,7 @@ from easybuild.tools.config import build_option from easybuild.tools.filetools import read_file from easybuild.tools.modules import modules_tool -from easybuild.tools.toolchain.toolchain import DUMMY_TOOLCHAIN_NAME, SYSTEM_TOOLCHAIN_NAME, is_system_toolchain +from easybuild.tools.toolchain.toolchain import SYSTEM_TOOLCHAIN_NAME, is_system_toolchain from easybuild.tools.toolchain.utilities import search_toolchain from easybuild.tools.utilities import INDENT_2SPACES, INDENT_4SPACES from easybuild.tools.utilities import import_available_modules, mk_md_table, mk_rst_table, nub, quote_str @@ -1024,8 +1024,7 @@ def list_toolchains(output_format=FORMAT_TXT): """Show list of known toolchains.""" _, all_tcs = search_toolchain('') - # filter deprecated 'dummy' toolchain - all_tcs = [x for x in all_tcs if x.NAME != DUMMY_TOOLCHAIN_NAME] + all_tcs = [x for x in all_tcs] all_tcs_names = [x.NAME for x in all_tcs] # start with dict that maps toolchain name to corresponding subclass of Toolchain diff --git a/easybuild/tools/options.py b/easybuild/tools/options.py index 49f6cc0de7..a7ac21027b 100644 --- a/easybuild/tools/options.py +++ b/easybuild/tools/options.py @@ -345,9 +345,6 @@ def override_options(self): 'accept-eula': ("Accept EULA for specified software [DEPRECATED, use --accept-eula-for instead!]", 'strlist', 'store', []), 'accept-eula-for': ("Accept EULA for specified software", 'strlist', 'store', []), - 'add-dummy-to-minimal-toolchains': ("Include dummy toolchain in minimal toolchain searches " - "[DEPRECATED, use --add-system-to-minimal-toolchains instead!]", - None, 'store_true', False), 'add-system-to-minimal-toolchains': ("Include system toolchain in minimal toolchain searches", None, 'store_true', False), 'allow-loaded-modules': ("List of software names for which to allow loaded modules in initial environment", diff --git a/easybuild/tools/toolchain/toolchain.py b/easybuild/tools/toolchain/toolchain.py index 308678a555..03edfa7359 100644 --- a/easybuild/tools/toolchain/toolchain.py +++ b/easybuild/tools/toolchain/toolchain.py @@ -74,12 +74,6 @@ _log = fancylogger.getLogger('tools.toolchain', fname=False) -# name/version for dummy toolchain -# if name==DUMMY_TOOLCHAIN_NAME and version==DUMMY_TOOLCHAIN_VERSION, do not load dependencies -# NOTE: use of 'dummy' toolchain is deprecated, replaced by 'system' toolchain (which always loads dependencies) -DUMMY_TOOLCHAIN_NAME = 'dummy' -DUMMY_TOOLCHAIN_VERSION = 'dummy' - SYSTEM_TOOLCHAIN_NAME = 'system' CCACHE = 'ccache' @@ -105,7 +99,7 @@ def is_system_toolchain(tc_name): """Return whether toolchain with specified name is a system toolchain or not.""" - return tc_name in [DUMMY_TOOLCHAIN_NAME, SYSTEM_TOOLCHAIN_NAME] + return tc_name in [SYSTEM_TOOLCHAIN_NAME] def env_vars_external_module(name, version, metadata): @@ -197,10 +191,6 @@ def __init__(self, name=None, version=None, mns=None, class_constants=None, tcde if name is None: raise EasyBuildError("Toolchain init: no name provided") self.name = name - if self.name == DUMMY_TOOLCHAIN_NAME: - self.log.deprecated("Use of 'dummy' toolchain is deprecated, use 'system' toolchain instead", '5.0', - silent=build_option('silent')) - self.name = SYSTEM_TOOLCHAIN_NAME if version is None: version = self.VERSION @@ -237,7 +227,7 @@ def __init__(self, name=None, version=None, mns=None, class_constants=None, tcde self.init_modpaths = self.mns.det_init_modulepaths(tc_dict) def is_system_toolchain(self): - """Return boolean to indicate whether this toolchain is a system(/dummy) toolchain.""" + """Return boolean to indicate whether this toolchain is a system toolchain.""" return is_system_toolchain(self.name) def set_minimal_build_env(self): diff --git a/test/framework/easyconfig.py b/test/framework/easyconfig.py index 7bf72fc57b..d27259b986 100644 --- a/test/framework/easyconfig.py +++ b/test/framework/easyconfig.py @@ -3576,19 +3576,6 @@ def test_det_subtoolchain_version(self): for subtoolchain_name in subtoolchains[current_tc['name']]] self.assertEqual(versions, [None, '']) - # --add-dummy-to-minimal-toolchains is still supported, but deprecated - self.allow_deprecated_behaviour() - init_config(build_options={'add_system_to_minimal_toolchains': False, 'add_dummy_to_minimal_toolchains': True}) - self.mock_stderr(True) - versions = [det_subtoolchain_version(current_tc, subtoolchain_name, optional_toolchains, cands) - for subtoolchain_name in subtoolchains[current_tc['name']]] - stderr = self.get_stderr() - self.mock_stderr(False) - self.assertEqual(versions, [None, '']) - depr_msg = "WARNING: Deprecated functionality, will no longer work in v5.0: " - depr_msg += "Use --add-system-to-minimal-toolchains instead of --add-dummy-to-minimal-toolchains" - self.assertIn(depr_msg, stderr) - # and GCCcore if existing too init_config(build_options={'add_system_to_minimal_toolchains': True}) current_tc = {'name': 'GCC', 'version': '4.9.3-2.25'} @@ -4130,9 +4117,6 @@ def test_fix_deprecated_easyconfigs(self): """Test fix_deprecated_easyconfigs function.""" test_ecs_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'easyconfigs', 'test_ecs') toy_ec = os.path.join(test_ecs_dir, 't', 'toy', 'toy-0.0.eb') - gzip_ec = os.path.join(test_ecs_dir, 'g', 'gzip', 'gzip-1.4.eb') - - gzip_ec_txt = read_file(gzip_ec) toy_ec_txt = read_file(toy_ec) test_ec = os.path.join(self.test_prefix, 'test.eb') @@ -4149,115 +4133,42 @@ def test_fix_deprecated_easyconfigs(self): regex = re.compile(r'^(toolchain\s*=.*)$', re.M) test_ectxt = regex.sub(r'\1\n\nsome_list = [x + "1" for x in ["one", "two", "three"]]', test_ectxt) - # test fixing the use of 'dummy' toolchain to SYSTEM - tc_regex = re.compile('^toolchain = .*', re.M) - tc_strs = [ - "{'name': 'dummy', 'version': 'dummy'}", - "{'name': 'dummy', 'version': ''}", - "{'name': 'dummy', 'version': '1.2.3'}", - "{'version': '', 'name': 'dummy'}", - "{'version': 'dummy', 'name': 'dummy'}", - ] - unknown_params_error_pattern = "Use of 2 unknown easyconfig parameters detected in test.eb: foo, some_list" - for tc_str in tc_strs: - # first check if names of local variables get fixed if 'dummy' toolchain is not used - init_config(build_options={'local_var_naming_check': 'error', 'silent': True}) - - write_file(test_ec, test_ectxt) - self.assertErrorRegex(EasyBuildError, unknown_params_error_pattern, EasyConfig, test_ec) - - self.mock_stderr(True) - self.mock_stdout(True) - fix_deprecated_easyconfigs([test_ec]) - stderr, stdout = self.get_stderr(), self.get_stdout() - self.mock_stderr(False) - self.mock_stdout(False) - self.assertFalse(stderr) - self.assertIn("test.eb... FIXED!", stdout) - - # parsing now works - ec = EasyConfig(test_ec) - - # cleanup - remove_file(glob.glob(os.path.join(test_ec + '.orig*'))[0]) - - # now inject use of 'dummy' toolchain - write_file(test_ec, tc_regex.sub("toolchain = %s" % tc_str, test_ectxt)) - - test_ec_txt = read_file(test_ec) - regex = re.compile("^toolchain = {.*'name': 'dummy'.*$", re.M) - self.assertTrue(regex.search(test_ec_txt), "Pattern '%s' found in: %s" % (regex.pattern, test_ec_txt)) - - # mimic default behaviour where only warnings are being printed; - # use of dummy toolchain or local variables not following recommended naming scheme is not fatal by default - init_config(build_options={'local_var_naming_check': 'warn', 'silent': False}) - self.mock_stderr(True) - self.mock_stdout(True) - ec = EasyConfig(test_ec) - stderr, stdout = self.get_stderr(), self.get_stdout() - self.mock_stderr(False) - self.mock_stdout(False) - - self.assertFalse(stdout) - - warnings = [ - "WARNING: Use of 2 unknown easyconfig parameters detected in test.eb: foo, some_list", - "Use of 'dummy' toolchain is deprecated, use 'system' toolchain instead", - ] - for warning in warnings: - self.assertIn(warning, stderr) - - init_config(build_options={'local_var_naming_check': 'error', 'silent': True}) - - # easyconfig doesn't parse because of local variables with name other than 'local_*' - self.assertErrorRegex(EasyBuildError, unknown_params_error_pattern, EasyConfig, test_ec) - - self.mock_stderr(True) - self.mock_stdout(True) - fix_deprecated_easyconfigs([toy_ec, test_ec, gzip_ec]) - stderr, stdout = self.get_stderr(), self.get_stdout() - self.mock_stderr(False) - self.mock_stdout(False) - - ectxt = read_file(test_ec) - self.assertFalse(regex.search(ectxt), "Pattern '%s' *not* found in: %s" % (regex.pattern, ectxt)) - regex = re.compile("^toolchain = SYSTEM$", re.M) - self.assertTrue(regex.search(ectxt), "Pattern '%s' found in: %s" % (regex.pattern, ectxt)) - - self.assertEqual(gzip_ec_txt, read_file(gzip_ec)) - self.assertEqual(toy_ec_txt, read_file(toy_ec)) - self.assertTrue(test_ec_txt != read_file(test_ec)) + # check if names of local variables get fixed + init_config(build_options={'local_var_naming_check': 'error', 'silent': True}) - # original easyconfig is backed up automatically - test_ecs = sorted([f for f in os.listdir(self.test_prefix) if f.startswith('test.eb')]) - self.assertEqual(len(test_ecs), 2) - backup_test_ec = os.path.join(self.test_prefix, test_ecs[1]) - self.assertEqual(test_ec_txt, read_file(backup_test_ec)) + write_file(test_ec, test_ectxt) + self.assertErrorRegex(EasyBuildError, unknown_params_error_pattern, EasyConfig, test_ec) - remove_file(backup_test_ec) + self.mock_stderr(True) + self.mock_stdout(True) + fix_deprecated_easyconfigs([test_ec]) + stderr, stdout = self.get_stderr(), self.get_stdout() + self.mock_stderr(False) + self.mock_stdout(False) + self.assertFalse(stderr) + self.assertIn("test.eb... FIXED!", stdout) - # parsing works now, toolchain is replaced with system toolchain - ec = EasyConfig(test_ec) - self.assertEqual(ec['toolchain'], {'name': 'system', 'version': 'system'}) - self.assertEqual(ec['configopts'], "--foobar --barfoo --barfoobaz") + # parsing now works + ec = EasyConfig(test_ec) + self.assertEqual(ec['configopts'], "--foobar --barfoo --barfoobaz") + self.assertFalse(stderr) + stdout = stdout.split('\n') + self.assertEqual(len(stdout), 6) + patterns = [ + r"^\* \[1/1\] fixing .*/test.eb\.\.\. FIXED!$", + r"^\s*\(changes made in place, original copied to .*/test.eb.orig_[0-9_]+\)$", + r'^$', + r"^All done! Fixed 1 easyconfigs \(out of 1 found\).$", + r'^$', + r'^$', + ] + for idx, pattern in enumerate(patterns): + self.assertTrue(re.match(pattern, stdout[idx]), "Pattern '%s' matches '%s'" % (pattern, stdout[idx])) - self.assertFalse(stderr) - stdout = stdout.split('\n') - self.assertEqual(len(stdout), 8) - patterns = [ - r"^\* \[1/3\] fixing .*/t/toy/toy-0.0.eb\.\.\. \(no changes made\)$", - r"^\* \[2/3\] fixing .*/test.eb\.\.\. FIXED!$", - r"^\s*\(changes made in place, original copied to .*/test.eb.orig_[0-9_]+\)$", - r"^\* \[3/3\] fixing .*/g/gzip/gzip-1.4.eb\.\.\. \(no changes made\)$", - r'^$', - r"^All done! Fixed 1 easyconfigs \(out of 3 found\).$", - r'^$', - r'^$', - ] - for idx, pattern in enumerate(patterns): - self.assertTrue(re.match(pattern, stdout[idx]), "Pattern '%s' matches '%s'" % (pattern, stdout[idx])) + # cleanup + remove_file(glob.glob(os.path.join(test_ec + '.orig*'))[0]) def test_parse_list_comprehension_scope(self): """Test parsing of an easyconfig file that uses a local variable in list comprehension.""" diff --git a/test/framework/toolchain.py b/test/framework/toolchain.py index e39bcd3016..380ced96e9 100644 --- a/test/framework/toolchain.py +++ b/test/framework/toolchain.py @@ -113,7 +113,7 @@ def test_foss_toolchain(self): self.get_toolchain("foss", version="2018a") def test_get_variable_system_toolchain(self): - """Test get_variable on system/dummy toolchain""" + """Test get_variable on system toolchain""" # system toolchain version doesn't really matter, but fine... for ver in ['system', '']: @@ -123,18 +123,6 @@ def test_get_variable_system_toolchain(self): self.assertEqual(tc.get_variable('CXX', typ=str), '') self.assertEqual(tc.get_variable('CFLAGS', typ=list), []) - # dummy toolchain is deprecated, so we need to allow for it (and catch the warnings that get printed) - self.allow_deprecated_behaviour() - - for ver in ['dummy', '']: - self.mock_stderr(True) - tc = self.get_toolchain('dummy', version=ver) - self.mock_stderr(False) - tc.prepare() - self.assertEqual(tc.get_variable('CC'), '') - self.assertEqual(tc.get_variable('CXX', typ=str), '') - self.assertEqual(tc.get_variable('CFLAGS', typ=list), []) - def test_is_system_toolchain(self): """Test is_system_toolchain method.""" @@ -152,23 +140,6 @@ def test_is_system_toolchain(self): tc = self.get_toolchain('intel', version='2018a') self.assertFalse(tc.is_system_toolchain()) - # using dummy toolchain is deprecated, so to test for that we need to explicitely allow using deprecated stuff - error_pattern = "Use of 'dummy' toolchain is deprecated" - for ver in ['dummy', '']: - self.assertErrorRegex(EasyBuildError, error_pattern, self.get_toolchain, 'dummy', version=ver) - - dummy_depr_warning = "WARNING: Deprecated functionality, will no longer work in v5.0: Use of 'dummy' toolchain" - - self.allow_deprecated_behaviour() - - for ver in ['dummy', '']: - self.mock_stderr(True) - tc = self.get_toolchain('dummy', version=ver) - stderr = self.get_stderr() - self.mock_stderr(False) - self.assertTrue(tc.is_system_toolchain()) - self.assertIn(dummy_depr_warning, stderr) - def test_toolchain_prepare_sysroot(self): """Test build environment setup done by Toolchain.prepare in case --sysroot is specified."""