Skip to content

Commit e596f7a

Browse files
authored
Merge pull request #3981 from boegel/fix_donwload_instructions
also print download instructions for extensions that use source_tmpl to specify name of source file
2 parents 74c9726 + 602439a commit e596f7a

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

easybuild/framework/easyblock.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,8 @@ def collect_exts_file_info(self, fetch_files=True, verify_checksums=True):
556556
source_urls = ext_options.get('source_urls', [])
557557
checksums = ext_options.get('checksums', [])
558558

559+
download_instructions = ext_options.get('download_instructions')
560+
559561
if ext_options.get('nosource', None):
560562
self.log.debug("No sources for extension %s, as indicated by 'nosource'", ext_name)
561563

@@ -588,7 +590,7 @@ def collect_exts_file_info(self, fetch_files=True, verify_checksums=True):
588590

589591
if fetch_files:
590592
src = self.fetch_source(source, checksums, extension=True,
591-
download_instructions=ext_options.get('download_instructions'))
593+
download_instructions=download_instructions)
592594
ext_src.update({
593595
# keep track of custom extract command (if any)
594596
'extract_cmd': src['cmd'],
@@ -610,7 +612,8 @@ def collect_exts_file_info(self, fetch_files=True, verify_checksums=True):
610612

611613
if fetch_files:
612614
src_path = self.obtain_file(src_fn, extension=True, urls=source_urls,
613-
force_download=force_download)
615+
force_download=force_download,
616+
download_instructions=download_instructions)
614617
if src_path:
615618
ext_src.update({'src': src_path})
616619
else:

test/framework/easyblock.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,6 +1570,21 @@ def test_download_instructions(self):
15701570
self.assertEqual(stderr, "Download instructions:\n\nExtension sources must be downloaded via example.com")
15711571
self.assertEqual(stdout, '')
15721572

1573+
# download instructions should also be printed if 'source_tmpl' is used to specify extension sources
1574+
self.contents = self.contents.replace(sources, "'source_tmpl': SOURCE_TAR_GZ,")
1575+
self.writeEC()
1576+
eb = EasyBlock(EasyConfig(self.eb_file))
1577+
1578+
self.mock_stderr(True)
1579+
self.mock_stdout(True)
1580+
self.assertErrorRegex(EasyBuildError, error_pattern, eb.fetch_step)
1581+
stderr = self.get_stderr().strip()
1582+
stdout = self.get_stdout().strip()
1583+
self.mock_stderr(False)
1584+
self.mock_stdout(False)
1585+
self.assertEqual(stderr, "Download instructions:\n\nExtension sources must be downloaded via example.com")
1586+
self.assertEqual(stdout, '')
1587+
15731588
# create dummy source file for extension
15741589
write_file(os.path.join(os.path.dirname(self.eb_file), 'ext_with_missing_sources-0.0.tar.gz'), '')
15751590

0 commit comments

Comments
 (0)