Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions easybuild/framework/easyconfig/easyconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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))
Expand All @@ -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:
Expand Down
50 changes: 0 additions & 50 deletions easybuild/toolchains/compiler/dummycompiler.py

This file was deleted.

38 changes: 0 additions & 38 deletions easybuild/toolchains/dummy.py

This file was deleted.

1 change: 0 additions & 1 deletion easybuild/tools/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
5 changes: 2 additions & 3 deletions easybuild/tools/docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions easybuild/tools/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 2 additions & 12 deletions easybuild/tools/toolchain/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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):
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down
149 changes: 30 additions & 119 deletions test/framework/easyconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'}
Expand Down Expand Up @@ -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')
Expand All @@ -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."""
Expand Down
Loading