Skip to content

Commit af15883

Browse files
authored
Merge pull request #4459 from branfosj/enhance_download_instructions
Enhance download instructions
2 parents eadfdc7 + 3e8632f commit af15883

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

easybuild/framework/easyblock.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
import traceback
5555
from concurrent.futures import ThreadPoolExecutor
5656
from datetime import datetime
57+
from textwrap import indent
5758

5859
import easybuild.tools.environment as env
5960
import easybuild.tools.toolchain as toolchain
@@ -953,7 +954,8 @@ def obtain_file(self, filename, extension=False, urls=None, download_filename=No
953954
if download_instructions is None:
954955
download_instructions = self.cfg['download_instructions']
955956
if download_instructions is not None and download_instructions != "":
956-
msg = "\nDownload instructions:\n\n" + download_instructions + '\n'
957+
msg = "\nDownload instructions:\n\n" + indent(download_instructions, ' ') + '\n\n'
958+
msg += "Make the files available in the active source path: %s\n" % ':'.join(source_paths())
957959
print_msg(msg, prefix=False, stderr=True)
958960
error_msg += "please follow the download instructions above, and make the file available "
959961
error_msg += "in the active source path (%s)" % ':'.join(source_paths())

test/framework/easyblock.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,7 +1582,8 @@ def test_download_instructions(self):
15821582
self.assertErrorRegex(EasyBuildError, error_pattern, eb.fetch_step)
15831583
stderr = self.get_stderr().strip()
15841584
self.mock_stderr(False)
1585-
self.assertIn("Download instructions:\n\nManual download from example.com required", stderr)
1585+
self.assertIn("Download instructions:\n\n Manual download from example.com required", stderr)
1586+
self.assertIn("Make the files available in the active source path", stderr)
15861587

15871588
# create dummy source file
15881589
write_file(os.path.join(os.path.dirname(self.eb_file), 'software_with_missing_sources-0.0.tar.gz'), '')
@@ -1596,7 +1597,8 @@ def test_download_instructions(self):
15961597
stderr = self.get_stderr().strip()
15971598
self.mock_stderr(False)
15981599
self.mock_stdout(False)
1599-
self.assertIn("Download instructions:\n\nManual download from example.com required", stderr)
1600+
self.assertIn("Download instructions:\n\n Manual download from example.com required", stderr)
1601+
self.assertIn("Make the files available in the active source path", stderr)
16001602

16011603
# wipe top-level download instructions, try again
16021604
self.contents = self.contents.replace(download_instructions, '')
@@ -1625,7 +1627,8 @@ def test_download_instructions(self):
16251627
stderr = self.get_stderr().strip()
16261628
self.mock_stderr(False)
16271629
self.mock_stdout(False)
1628-
self.assertIn("Download instructions:\n\nExtension sources must be downloaded via example.com", stderr)
1630+
self.assertIn("Download instructions:\n\n Extension sources must be downloaded via example.com", stderr)
1631+
self.assertIn("Make the files available in the active source path", stderr)
16291632

16301633
# download instructions should also be printed if 'source_tmpl' is used to specify extension sources
16311634
self.contents = self.contents.replace(sources, "'source_tmpl': SOURCE_TAR_GZ,")
@@ -1638,7 +1641,8 @@ def test_download_instructions(self):
16381641
stderr = self.get_stderr().strip()
16391642
self.mock_stderr(False)
16401643
self.mock_stdout(False)
1641-
self.assertIn("Download instructions:\n\nExtension sources must be downloaded via example.com", stderr)
1644+
self.assertIn("Download instructions:\n\n Extension sources must be downloaded via example.com", stderr)
1645+
self.assertIn("Make the files available in the active source path", stderr)
16421646

16431647
# create dummy source file for extension
16441648
write_file(os.path.join(os.path.dirname(self.eb_file), 'ext_with_missing_sources-0.0.tar.gz'), '')

0 commit comments

Comments
 (0)