Skip to content

Commit daa554d

Browse files
committed
Move type check in collect_exts_file_info to top of loop
The loop body is so large, that the allowed/checked types are very hard to find.
1 parent b5c1dd9 commit daa554d

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

easybuild/framework/easyblock.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,12 @@ def collect_exts_file_info(self, fetch_files=True, verify_checksums=True):
553553
force_download = build_option('force_download') in [FORCE_DOWNLOAD_ALL, FORCE_DOWNLOAD_SOURCES]
554554

555555
for ext in exts_list:
556-
if isinstance(ext, (list, tuple)) and ext:
556+
if isinstance(ext, str):
557+
exts_sources.append({'name': ext})
558+
else:
559+
if not isinstance(ext, (list, tuple)) or not ext:
560+
raise EasyBuildError("Extension specified in unknown format (not a string/list/tuple)")
561+
557562
# expected format: (name, version, options (dict))
558563
# name and version can use templates, resolved via parent EC
559564

@@ -725,12 +730,6 @@ def collect_exts_file_info(self, fetch_files=True, verify_checksums=True):
725730

726731
exts_sources.append(ext_src)
727732

728-
elif isinstance(ext, str):
729-
exts_sources.append({'name': ext})
730-
731-
else:
732-
raise EasyBuildError("Extension specified in unknown format (not a string/list/tuple)")
733-
734733
return exts_sources
735734

736735
def obtain_file(self, filename, extension=False, urls=None, download_filename=None, force_download=False,

0 commit comments

Comments
 (0)