From f049a82d9df9d2406895318772ba1952a58fc927 Mon Sep 17 00:00:00 2001 From: Andrew Wason Date: Sat, 4 May 2024 20:28:02 -0400 Subject: [PATCH] Override host/target for src/docs if Qt >= 6.7.0 (#776) * Override host/target for src/docs if Qt >= 6.7.0 Fixes https://github.com/miurahr/aqtinstall/issues/775 --- aqt/archives.py | 7 ++++++- aqt/installer.py | 13 +++++++++++-- aqt/metadata.py | 15 +++++++++------ 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/aqt/archives.py b/aqt/archives.py index 1c8ba1b7..b1e9aff1 100644 --- a/aqt/archives.py +++ b/aqt/archives.py @@ -377,9 +377,14 @@ def _append_depends_tool(self, arch, tool_name): 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.os_name == "windows": + os_name += "_x86" + elif os_name != "linux_arm64" and os_name != "all_os": + os_name += "_x64" 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")), + os_name, self.target, # tools_ifw/ name, diff --git a/aqt/installer.py b/aqt/installer.py index df1d8f70..46b8ccea 100644 --- a/aqt/installer.py +++ b/aqt/installer.py @@ -481,6 +481,10 @@ def _run_src_doc_examples(self, flavor, args, cmd_name: Optional[str] = None): else: qt_version = args.qt_version Cli._validate_version_str(qt_version) + # Override target/os for recent Qt + if Version(qt_version) in SimpleSpec(">=6.7.0"): + target = "qt" + os_name = "all_os" if args.timeout is not None: timeout = (args.timeout, args.timeout) else: @@ -673,11 +677,16 @@ def run_list_tool(self, args: ListToolArgumentParser): show_list(meta) def run_list_src_doc_examples(self, args: ListArgumentParser, cmd_type: str): - target = "desktop" # The only valid target for src/doc/examples is "desktop" + target = "desktop" version = Cli._determine_qt_version(args.qt_version_spec, args.host, target, arch="") + if version >= Version("6.7.0"): + target = "qt" + host = "all_os" + else: + host = args.host is_fetch_modules: bool = getattr(args, "modules", False) meta = MetadataFactory( - archive_id=ArchiveId("qt", args.host, target), + archive_id=ArchiveId("qt", host, target), src_doc_examples_query=MetadataFactory.SrcDocExamplesQuery(cmd_type, version, is_fetch_modules), ) show_list(meta) diff --git a/aqt/metadata.py b/aqt/metadata.py index 8cfc38be..003ff613 100644 --- a/aqt/metadata.py +++ b/aqt/metadata.py @@ -199,12 +199,13 @@ def get_semantic_version(qt_ver: str, is_preview: bool) -> Optional[Version]: class ArchiveId: CATEGORIES = ("tools", "qt") - HOSTS = ("windows", "mac", "linux", "linux_arm64") + HOSTS = ("windows", "mac", "linux", "linux_arm64", "all_os") TARGETS_FOR_HOST = { "windows": ["android", "desktop", "winrt"], "mac": ["android", "desktop", "ios"], "linux": ["android", "desktop"], "linux_arm64": ["desktop"], + "all_os": ["qt"], } EXTENSIONS_REQUIRED_ANDROID_QT6 = {"x86_64", "x86", "armv7", "arm64_v8a"} ALL_EXTENSIONS = {"", "wasm", "src_doc_examples", *EXTENSIONS_REQUIRED_ANDROID_QT6} @@ -232,7 +233,7 @@ def is_tools(self) -> bool: def to_url(self) -> str: return "online/qtsdkrepository/{os}{arch}/{target}/".format( os=self.host, - arch=("_x86" if self.host == "windows" else ("" if self.host == "linux_arm64" else "_x64")), + arch=("_x86" if self.host == "windows" else ("" if self.host in ("linux_arm64", "all_os") else "_x64")), target=self.target, ) @@ -868,8 +869,9 @@ def matches_arch(element: Element) -> bool: def fetch_modules_sde(self, cmd_type: str, version: Version) -> List[str]: """Returns list of modules for src/doc/examples""" - assert ( - cmd_type in ("doc", "examples") and self.archive_id.target == "desktop" + assert cmd_type in ("doc", "examples") and self.archive_id.target in ( + "desktop", + "qt", ), "Internal misuse of fetch_modules_sde" qt_ver_str = self._get_qt_version_str(version) modules_meta = self._fetch_module_metadata(self.archive_id.to_folder(qt_ver_str, "src_doc_examples")) @@ -885,8 +887,9 @@ def fetch_modules_sde(self, cmd_type: str, version: Version) -> List[str]: def fetch_archives_sde(self, cmd_type: str, version: Version) -> List[str]: """Returns list of archives for src/doc/examples""" - assert ( - cmd_type in ("src", "doc", "examples") and self.archive_id.target == "desktop" + assert cmd_type in ("src", "doc", "examples") and self.archive_id.target in ( + "desktop", + "qt", ), "Internal misuse of fetch_archives_sde" return self.fetch_archives(version, cmd_type, [], is_sde=True)