Better warning message when fetching non-existent URL
This commit is contained in:
parent
3c9b0ee2ea
commit
0ca69fef42
@ -306,13 +306,13 @@ def fetch(self):
|
|||||||
content_types = re.findall(r'Content-Type:[^\r\n]+', headers,
|
content_types = re.findall(r'Content-Type:[^\r\n]+', headers,
|
||||||
flags=re.IGNORECASE)
|
flags=re.IGNORECASE)
|
||||||
if content_types and 'text/html' in content_types[-1]:
|
if content_types and 'text/html' in content_types[-1]:
|
||||||
tty.warn("The contents of ",
|
msg = ("The contents of {0} look like HTML. Either the URL "
|
||||||
(self.archive_file if self.archive_file is not None
|
"you are trying to use does not exist or you have an "
|
||||||
else "the archive"),
|
"internet gateway issue. You can remove the bad archive "
|
||||||
" look like HTML.",
|
"using 'spack clean <package>', then try again using "
|
||||||
"The checksum will likely be bad. If it is, you can use",
|
"the correct URL.")
|
||||||
"'spack clean <package>' to remove the bad archive, then",
|
tty.warn(msg.format(self.archive_file or "the archive"))
|
||||||
"fix your internet gateway issue and install again.")
|
|
||||||
if save_file:
|
if save_file:
|
||||||
os.rename(partial_file, save_file)
|
os.rename(partial_file, save_file)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user