Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance download instructions by mentioning active source path #4459

Merged
merged 2 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion easybuild/framework/easyblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import time
import traceback
from datetime import datetime
from textwrap import indent

import easybuild.tools.environment as env
import easybuild.tools.toolchain as toolchain
Expand Down Expand Up @@ -952,7 +953,8 @@ def obtain_file(self, filename, extension=False, urls=None, download_filename=No
if download_instructions is None:
download_instructions = self.cfg['download_instructions']
if download_instructions is not None and download_instructions != "":
msg = "\nDownload instructions:\n\n" + download_instructions + '\n'
msg = "\nDownload instructions:\n\n" + indent(download_instructions, ' ') + '\n\n'
msg += "Make the files available in the active source path: %s\n" % ':'.join(source_paths())
print_msg(msg, prefix=False, stderr=True)
error_msg += "please follow the download instructions above, and make the file available "
error_msg += "in the active source path (%s)" % ':'.join(source_paths())
Expand Down
12 changes: 8 additions & 4 deletions test/framework/easyblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -1582,7 +1582,8 @@ def test_download_instructions(self):
self.assertErrorRegex(EasyBuildError, error_pattern, eb.fetch_step)
stderr = self.get_stderr().strip()
self.mock_stderr(False)
self.assertIn("Download instructions:\n\nManual download from example.com required", stderr)
self.assertIn("Download instructions:\n\n Manual download from example.com required", stderr)
self.assertIn("Make the files available in the active source path", stderr)

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

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

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

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