From c61c437d026ca13fedeb19cd51b1a8c2f1ad7a2a Mon Sep 17 00:00:00 2001 From: Samuel Moors Date: Fri, 27 Jun 2025 18:40:03 +0200 Subject: [PATCH 1/2] retry fetching extensions from PyPI with alternative download_filename --- easybuild/framework/easyblock.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/easybuild/framework/easyblock.py b/easybuild/framework/easyblock.py index 021d524012..5673f50100 100644 --- a/easybuild/framework/easyblock.py +++ b/easybuild/framework/easyblock.py @@ -717,9 +717,13 @@ def collect_exts_file_info(self, fetch_files=True, verify_checksums=True): # if no sources are specified via 'sources', fall back to 'source_tmpl' src_fn = ext_options.get('source_tmpl') + warning_only = False if src_fn is None: # use default template for name of source file if none is specified src_fn = '%(name)s-%(version)s.tar.gz' + if len(source_urls) == 1 and PYPI_PKG_URL_PATTERN in source_urls[0]: + # allow retrying with alternative download_filename + warning_only = True elif not isinstance(src_fn, str): error_msg = "source_tmpl value must be a string! (found value of type '%s'): %s" raise EasyBuildError(error_msg, type(src_fn).__name__, src_fn) @@ -729,7 +733,17 @@ def collect_exts_file_info(self, fetch_files=True, verify_checksums=True): if fetch_files: src_path = self.obtain_file(src_fn, extension=True, urls=source_urls, force_download=force_download, - download_instructions=download_instructions) + download_instructions=download_instructions, + warning_only=warning_only) + if not src_path: + # retry with alternative download_filename + alt_name = resolve_template('%(name)s', template_values).replace("-", "_") + src_version = resolve_template('%(version)s', template_values) + alt_download_fn = f'{alt_name}-{src_version}.tar.gz' + src_path = self.obtain_file(src_fn, extension=True, urls=source_urls, + force_download=force_download, + download_instructions=download_instructions, + download_filename=alt_download_fn) if src_path: ext_src.update({'src': src_path}) else: From 04da4999ff4605cfc7c47d08bdd529b76e5722fa Mon Sep 17 00:00:00 2001 From: Samuel Moors Date: Mon, 30 Jun 2025 11:31:56 +0200 Subject: [PATCH 2/2] use is_pypi_source variable name --- easybuild/framework/easyblock.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/easybuild/framework/easyblock.py b/easybuild/framework/easyblock.py index 5673f50100..51575cc070 100644 --- a/easybuild/framework/easyblock.py +++ b/easybuild/framework/easyblock.py @@ -717,13 +717,13 @@ def collect_exts_file_info(self, fetch_files=True, verify_checksums=True): # if no sources are specified via 'sources', fall back to 'source_tmpl' src_fn = ext_options.get('source_tmpl') - warning_only = False + is_pypi_source = False if src_fn is None: # use default template for name of source file if none is specified src_fn = '%(name)s-%(version)s.tar.gz' if len(source_urls) == 1 and PYPI_PKG_URL_PATTERN in source_urls[0]: # allow retrying with alternative download_filename - warning_only = True + is_pypi_source = True elif not isinstance(src_fn, str): error_msg = "source_tmpl value must be a string! (found value of type '%s'): %s" raise EasyBuildError(error_msg, type(src_fn).__name__, src_fn) @@ -734,8 +734,8 @@ def collect_exts_file_info(self, fetch_files=True, verify_checksums=True): src_path = self.obtain_file(src_fn, extension=True, urls=source_urls, force_download=force_download, download_instructions=download_instructions, - warning_only=warning_only) - if not src_path: + warning_only=is_pypi_source) + if not src_path and is_pypi_source: # retry with alternative download_filename alt_name = resolve_template('%(name)s', template_values).replace("-", "_") src_version = resolve_template('%(version)s', template_values)