Skip to content

Commit

Permalink
handle cases where extensions don't exist.
Browse files Browse the repository at this point in the history
for example with windows desktop 6.8.1 win64_msvc2022_arm64_cross_compiled
both qtwebengine and qtpdf don't exist.

Signed-off-by: Alexandre 'Kidev' Poumaroux <[email protected]>
  • Loading branch information
tsteven4 authored and Kidev committed Dec 16, 2024
1 parent 77dff51 commit 5d80b7c
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions aqt/archives.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,21 +438,33 @@ def _get_archives_base(self, name, target_packages):
"online/qtsdkrepository", os_name, "extensions", ext, self._version_str(), arch
)
extensions_xml_url = posixpath.join(extensions_target_folder, "Updates.xml")
extensions_xml_text = self._download_update_xml(extensions_xml_url)
update_xmls.append(UpdateXmls(extensions_target_folder, extensions_xml_text))
# The extension may or may not exist for this version and arch.
try:
extensions_xml_text = self._download_update_xml(extensions_xml_url, True)
except ArchiveDownloadError:
# In case _download_update_xml ignores the hash and tries to get the url.
pass
if extensions_xml_text:
self.logger.info("Found extension {}".format(ext))
update_xmls.append(UpdateXmls(extensions_target_folder, extensions_xml_text))

self._parse_update_xmls(update_xmls, target_packages)

def _download_update_xml(self, update_xml_path):
def _download_update_xml(self, update_xml_path, silent=False):
"""Hook for unit test."""
if not Settings.ignore_hash:
try:
xml_hash = get_hash(update_xml_path, Settings.hash_algorithm, self.timeout)
except ChecksumDownloadFailure:
self.logger.warning(
"Failed to download checksum for the file 'Updates.xml'. This may happen on unofficial mirrors."
)
xml_hash = None
if silent:
return None
else:
self.logger.warning(
"Failed to download checksum for the file '{}'. This may happen on unofficial mirrors.".format(
update_xml_path
)
)
xml_hash = None
else:
xml_hash = None
return getUrl(posixpath.join(self.base, update_xml_path), self.timeout, xml_hash)
Expand Down

0 comments on commit 5d80b7c

Please sign in to comment.