Skip to content

Commit

Permalink
Override host/target for src/docs if Qt >= 6.7.0 (#776)
Browse files Browse the repository at this point in the history
* Override host/target for src/docs if Qt >= 6.7.0

Fixes #775
  • Loading branch information
rectalogic authored May 5, 2024
1 parent b629c84 commit f049a82
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
7 changes: 6 additions & 1 deletion aqt/archives.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
13 changes: 11 additions & 2 deletions aqt/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down
15 changes: 9 additions & 6 deletions aqt/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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,
)

Expand Down Expand Up @@ -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"))
Expand All @@ -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)

Expand Down

0 comments on commit f049a82

Please sign in to comment.