diff --git a/easybuild/easyblocks/c/clang.py b/easybuild/easyblocks/c/clang.py index 12922b4dfa..a89daf175d 100644 --- a/easybuild/easyblocks/c/clang.py +++ b/easybuild/easyblocks/c/clang.py @@ -193,14 +193,14 @@ def prepare_step(self, *args, **kwargs): build_targets = self.cfg['build_targets'] if build_targets is None: arch = get_cpu_architecture() - default_targets = DEFAULT_TARGETS_MAP.get(arch, None) - if default_targets: + try: + default_targets = DEFAULT_TARGETS_MAP[arch][:] # If CUDA is included as a dep, add NVPTX as a target (could also support AMDGPU if we knew how) if get_software_root("CUDA"): default_targets += ["NVPTX"] self.cfg['build_targets'] = build_targets = default_targets self.log.debug("Using %s as default build targets for CPU/GPU architecture %s.", default_targets, arch) - else: + except KeyError: raise EasyBuildError("No default build targets defined for CPU architecture %s.", arch) # carry on with empty list from this point forward if no build targets are specified diff --git a/easybuild/easyblocks/l/llvm.py b/easybuild/easyblocks/l/llvm.py index 6d67e5f5c3..afb1cfdcf5 100644 --- a/easybuild/easyblocks/l/llvm.py +++ b/easybuild/easyblocks/l/llvm.py @@ -65,11 +65,11 @@ def configure_step(self): build_targets = self.cfg['build_targets'] if build_targets is None: arch = get_cpu_architecture() - default_targets = DEFAULT_TARGETS_MAP.get(arch, None) - if default_targets: + try: + default_targets = DEFAULT_TARGETS_MAP[arch][:] self.cfg['build_targets'] = build_targets = default_targets self.log.debug("Using %s as default build targets for CPU architecture %s.", default_targets, arch) - else: + except KeyError: raise EasyBuildError("No default build targets defined for CPU architecture %s.", arch) unknown_targets = [target for target in build_targets if target not in CLANG_TARGETS]