Skip to content

Commit

Permalink
Fix WASM (#846)
Browse files Browse the repository at this point in the history
* Rewrite WASM support

* Add WASM tests to CI, update CI to test more the latest versions, add auto EMSDK version detection function

* Fix some mistakes, typos, moved emsdk version function into BuildJob

* Fix issue related to extensions interfering with wasm on 6.8+

* Fix tests

* Remove dep on Version in CI

* Remove safety before patch

* handle cases where extensions don't exist.

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]>

* for --long-modules assume extension doesn't exist on download error.

Signed-off-by: Alexandre 'Kidev' Poumaroux <[email protected]>

* for --modules assume extension doesn't exist for download failures.

Signed-off-by: Alexandre 'Kidev' Poumaroux <[email protected]>

* reformat with black

Signed-off-by: Alexandre 'Kidev' Poumaroux <[email protected]>

* fix flake8 regression that doesn't occur locally.

Signed-off-by: Alexandre 'Kidev' Poumaroux <[email protected]>

* Fix autodesktop by also updating the OS when searching for a valid desktop version to download

* Fix extension issue, reduce the possible retry for getting extensions to prevent server spam

* Fix CI asking for msvc2019 on 6.8+ but its no longer supported

* Make CI use C++20 and MSVC2022

* Fix linux build

* Update runners to windows-2022

Signed-off-by: Alexandre 'Kidev' Poumaroux <[email protected]>

* Fix patching

Signed-off-by: Alexandre 'Kidev' Poumaroux <[email protected]>

* Add back the semantic version changes to prevent crashes, add tests for it

* Update checks

* Cast 'https://mirrors.ustc.edu.cn' to the shadow realm

* Again

* Update settings.ini

* Update settings.ini

* Update settings.ini

* Remove one_rep on silent

* Update settings.ini

* Restore master settings, remove hash check

* ci: Use specific mirror

Attempt to work around download errors in Azure due to Qt's official download site often redirecting to mirrors to which the network connection is unstable

Signed-off-by: Alexandre 'Kidev' Poumaroux <[email protected]>

* Re enable hash checking

* Treat read timeout error during download as connection error

Signed-off-by: Alexandre 'Kidev' Poumaroux <[email protected]>

* Add test for modules in WASM with autodesktop

* Fix format

* Fix test

* Make '--autodesktop' trigger its own install process, and test it

* Fix older autodesktop tests

* Add mock update files for 680 wasm, add test for wasm 680 autodesktop

* Passes the additional tests

* Fix format

* Improve coverage, fix format

* Fix tests and improve logging or install

* Fix format

* Fix regression in other tests

* Use flavor

* Fix line len

* Fix codeql

* Fix list-qt for WASM arch on 6.5.x and 6.6.x, restore to original download URL

* Fix test error

* Revert ci settings URL as it is never used by clients, only in CI

* Add comment for clarity in ci/settings.ini

---------

Signed-off-by: Alexandre 'Kidev' Poumaroux <[email protected]>
Co-authored-by: tsteven4 <[email protected]>
Co-authored-by: J.D. Purcell <[email protected]>
  • Loading branch information
3 people authored Jan 6, 2025
1 parent 673b169 commit a09b5ce
Show file tree
Hide file tree
Showing 23 changed files with 9,544 additions and 172 deletions.
40 changes: 19 additions & 21 deletions aqt/archives.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,7 @@ def _get_list(self, item: Optional[Element]) -> Iterable[str]:
return []

def _get_boolean(self, item) -> bool:
if "true" == item:
return True
else:
return False
return bool("true" == item)


class QtArchives:
Expand Down Expand Up @@ -368,20 +365,33 @@ def _module_name_suffix(self, module: str) -> str:
return f"{module}.{self.arch}"

def _target_packages(self) -> ModuleToPackage:
"""Build mapping between module names and their possible package names"""
if self.all_extra:
return ModuleToPackage({})

base_package = {self._base_module_name(): list(self._base_package_names())}
target_packages = ModuleToPackage(base_package if self.is_include_base_package else {})

for module in self.mod_list:
suffix = self._module_name_suffix(module)
prefix = "qt.qt{}.{}.".format(self.version.major, self._version_str())
basic_prefix = "qt.{}.".format(self._version_str())

# All possible package name formats
package_names = [
f"qt.qt{self.version.major}.{self._version_str()}.{suffix}",
f"qt.{self._version_str()}.{suffix}",
f"{prefix}{suffix}",
f"{basic_prefix}{suffix}",
f"{prefix}addons.{suffix}",
f"{basic_prefix}addons.{suffix}",
f"extensions.{module}.{self._version_str()}.{self.arch}",
f"{prefix}{module}.{self.arch}", # Qt6.8+ format
f"{basic_prefix}{module}.{self.arch}", # Qt6.8+ format
f"{prefix}addons.{module}.{self.arch}", # Qt6.8+ addons format
f"{basic_prefix}addons.{module}.{self.arch}", # Qt6.8+ addons format
]
if not module.startswith("addons."):
package_names.append(f"qt.qt{self.version.major}.{self._version_str()}.addons.{suffix}")
target_packages.add(module, package_names)

target_packages.add(module, list(set(package_names))) # Remove duplicates

return target_packages

def _get_archives(self):
Expand All @@ -394,18 +404,6 @@ def _get_archives(self):
name = f"qt{self.version.major}_{self._version_str()}{self._arch_ext()}"
self._get_archives_base(name, self._target_packages())

def _append_depends_tool(self, arch, tool_name):
os_target_folder = posixpath.join(
"online/qtsdkrepository",
self.os_name + ("_x86" if self.os_name == "windows" else ("" if self.os_name == "linux_arm64" else "_x64")),
self.target,
tool_name,
)
update_xml_url = posixpath.join(os_target_folder, "Updates.xml")
update_xml_text = self._download_update_xml(update_xml_url)
update_xml = Updates.fromstring(self.base, update_xml_text)
self._append_tool_update(os_target_folder, update_xml, arch, None)

def _get_archives_base(self, name, target_packages):
os_name = self.os_name
if self.target == "android" and self.version >= Version("6.7.0"):
Expand Down
2 changes: 2 additions & 0 deletions aqt/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ def downloadBinaryFile(url: str, out: Path, hash_algo: str, exp: Optional[bytes]
fd.write(chunk)
hash.update(chunk)
fd.flush()
except requests.exceptions.ReadTimeout as e:
raise ArchiveConnectionError(f"Read timeout: {e.args}") from e
except Exception as e:
raise ArchiveDownloadError(f"Download of {filename} has error: {e}") from e
if exp is not None and hash.digest() != exp:
Expand Down
Loading

0 comments on commit a09b5ce

Please sign in to comment.