Skip to content

Commit

Permalink
feat: list-doc recognize android and wasm in all_os
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
  • Loading branch information
miurahr committed Jul 2, 2024
1 parent 649c55e commit 4c69408
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion aqt/archives.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ def _get_archives(self):
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.os_name + ("_x86" if self.os_name == "windows" else ("" if self.os_name == "linux_arm64" or self.target == "wasm" else "_x64")),
self.target,
tool_name,
)
Expand Down
20 changes: 10 additions & 10 deletions aqt/installer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
#
# Copyright (C) 2018 Linus Jahn <lnj@kaidan.im>
# Copyright (C) 2019-2021 Hiroshi Miura <miurahr@linux.com>
# Copyright (C) 2019-2024 Hiroshi Miura <miurahr@linux.com>
# Copyright (C) 2020, Aurélien Gâteau
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
Expand Down Expand Up @@ -750,13 +750,13 @@ def _set_install_qt_parser(self, install_qt_parser, *, is_legacy: bool):
def _set_install_tool_parser(self, install_tool_parser, *, is_legacy: bool):
install_tool_parser.set_defaults(func=self.run_install_tool, is_legacy=is_legacy)
install_tool_parser.add_argument(
"host", choices=["linux", "linux_arm64", "mac", "windows", "windows_arm64"], help="host os name"
"host", choices=["linux", "linux_arm64", "mac", "windows", "windows_arm64", "all_os"], help="host os name"
)
if not is_legacy:
install_tool_parser.add_argument(
"target",
default=None,
choices=["desktop", "winrt", "android", "ios"],
choices=["wasm", "desktop", "winrt", "android", "ios"],
help="Target SDK.",
)
install_tool_parser.add_argument("tool_name", help="Name of tool such as tools_ifw, tools_mingw")
Expand Down Expand Up @@ -809,7 +809,7 @@ def make_parser_sde(cmd: str, desc: str, is_legacy: bool, action, is_add_kde: bo
def make_parser_list_sde(cmd: str, desc: str, cmd_type: str):
parser = subparsers.add_parser(cmd, description=desc)
parser.add_argument(
"host", choices=["linux", "linux_arm64", "mac", "windows", "windows_arm64"], help="host os name"
"host", choices=["linux", "linux_arm64", "mac", "windows", "windows_arm64", "all_os"], help="host os name"
)
parser.add_argument(
"qt_version_spec",
Expand Down Expand Up @@ -859,13 +859,13 @@ def _make_list_qt_parser(self, subparsers: argparse._SubParsersAction):
"$ aqt list-qt mac desktop --archives 5.14.0 clang_64 debug_info # list archives in debug_info module\n",
)
list_parser.add_argument(
"host", choices=["linux", "linux_arm64", "mac", "windows", "windows_arm64"], help="host os name"
"host", choices=["linux", "linux_arm64", "mac", "windows", "windows_arm64", "all_os"], help="host os name"
)
list_parser.add_argument(
"target",
nargs="?",
default=None,
choices=["desktop", "winrt", "android", "ios"],
choices=["desktop", "winrt", "android", "ios", "qt", "wasm"],
help="Target SDK. When omitted, this prints all the targets available for a host OS.",
)
list_parser.add_argument(
Expand Down Expand Up @@ -1034,18 +1034,18 @@ def _set_common_arguments(self, subparser, *, is_legacy: bool, is_target_depreca
if is_legacy:
subparser.add_argument("qt_version", help='Qt version in the format of "5.X.Y"')
subparser.add_argument(
"host", choices=["linux", "linux_arm64", "mac", "windows", "windows_arm64"], help="host os name"
"host", choices=["linux", "linux_arm64", "mac", "windows", "windows_arm64", "all_os"], help="host os name"
)
if is_target_deprecated:
subparser.add_argument(
"target",
choices=["desktop", "winrt", "android", "ios"],
choices=["desktop", "winrt", "android", "ios", "wasm"],
nargs="?",
help="Ignored. This parameter is deprecated and marked for removal in a future release. "
"It is present here for backwards compatibility.",
)
else:
subparser.add_argument("target", choices=["desktop", "winrt", "android", "ios"], help="target sdk")
subparser.add_argument("target", choices=["desktop", "winrt", "android", "ios", "wasm"], help="target sdk")
if not is_legacy:
subparser.add_argument(
"qt_version_spec",
Expand Down Expand Up @@ -1114,7 +1114,7 @@ def _get_autodesktop_dir_and_arch(
self.logger.info(f"Found installed {host}-desktop Qt at {installed_desktop_arch_dir}")
return installed_desktop_arch_dir.name, None

default_desktop_arch = MetadataFactory(ArchiveId("qt", host, "desktop")).fetch_default_desktop_arch(version, is_msvc)
default_desktop_arch = MetadataFactory(ArchiveId("qt", host, "desktop")).fetch_default_desktop_arch(version, is_msvc, is_wasm)
desktop_arch_dir = QtRepoProperty.get_arch_dir_name(host, default_desktop_arch, version)
expected_desktop_arch_path = base_path / dir_for_version(version) / desktop_arch_dir

Expand Down
10 changes: 7 additions & 3 deletions aqt/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class ArchiveId:
"mac": ["android", "desktop", "ios"],
"linux": ["android", "desktop"],
"linux_arm64": ["desktop"],
"all_os": ["qt"],
"all_os": ["android", "qt", "wasm"],
}
EXTENSIONS_REQUIRED_ANDROID_QT6 = {"x86_64", "x86", "armv7", "arm64_v8a"}
ALL_EXTENSIONS = {"", "wasm", "src_doc_examples", *EXTENSIONS_REQUIRED_ANDROID_QT6}
Expand All @@ -232,6 +232,8 @@ def is_tools(self) -> bool:
return self.category == "tools"

def to_url(self) -> str:
if self.host == "all_os":
return "online/qtsdkrepository/{host}/{target}/".format(host=self.host, target=self.target)
return "online/qtsdkrepository/{os}{arch}/{target}/".format(
os=self.host,
arch=(
Expand Down Expand Up @@ -269,6 +271,8 @@ def all_extensions(self, version: Version) -> List[str]:
return [""]

def __str__(self) -> str:
if self.host == "all_os":
return "{host}/{target}".format(host=self.host, target=self.target)
return "{cat}/{host}/{target}".format(
cat=self.category,
host=self.host,
Expand Down Expand Up @@ -950,9 +954,9 @@ def describe_filters(self) -> str:
return str(self.archive_id)
return "{} with spec {}".format(self.archive_id, self.spec)

def fetch_default_desktop_arch(self, version: Version, is_msvc: bool = False) -> str:
def fetch_default_desktop_arch(self, version: Version, is_msvc: bool = False, is_wasm: bool = False) -> str:
assert self.archive_id.target == "desktop", "This function is meant to fetch desktop architectures"
if self.archive_id.host == "linux":
if self.archive_id.host == "linux" or is_wasm:
if version >= Version("6.7.0"):
return "linux_gcc_64"
else:
Expand Down

0 comments on commit 4c69408

Please sign in to comment.