-
-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix WASM #846
Fix WASM #846
Changes from 31 commits
de06f45
7ec6970
1df829a
cacabe8
11470f9
73bc8ad
77dff51
5d80b7c
001bbc8
4408ba6
c6955a6
dfc1d97
c8ec8b8
44c7762
c40af54
0008f42
592f875
3f108bc
1aa5216
6e785f0
356a2b8
bbaa833
29358b1
1a52e5f
7f695c4
07ff4ce
b92d40f
2c7ba14
b734cdd
7a2a41b
2288b1d
3568115
7cde90d
de6e325
bbd31a9
2e8abc2
f014c69
06a5098
aad5871
37ae2fa
44f1a90
84fad94
f9f1417
93f05d0
b14f120
0cd24a0
c9451c3
4dbb72f
eca7ef6
a46f3a7
9078341
0343d61
a5a075b
08328f2
3987df3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -185,22 +185,58 @@ def get_semantic_version(qt_ver: str, is_preview: bool) -> Optional[Version]: | |
and patch gets all the rest. | ||
As of May 2021, the version strings at https://download.qt.io/online/qtsdkrepository | ||
conform to this pattern; they are not guaranteed to do so in the future. | ||
As of December 2024, it can handle version strings like 6_7_3 as well. | ||
""" | ||
if not qt_ver or any(not ch.isdigit() for ch in qt_ver): | ||
if not qt_ver: | ||
return None | ||
|
||
# Handle versions with underscores (new format) | ||
if "_" in qt_ver: | ||
parts = qt_ver.split("_") | ||
if not (2 <= len(parts) <= 3): | ||
return None | ||
|
||
try: | ||
version_parts = [int(p) for p in parts] | ||
except ValueError: | ||
return None | ||
|
||
major, minor = version_parts[:2] | ||
patch = version_parts[2] if len(version_parts) > 2 else 0 | ||
|
||
if is_preview: | ||
minor_patch_combined = int(f"{minor}{patch}") if patch > 0 else minor | ||
return Version( | ||
major=major, | ||
minor=minor_patch_combined, | ||
patch=0, | ||
prerelease=("preview",), | ||
) | ||
|
||
return Version( | ||
major=major, | ||
minor=minor, | ||
patch=patch, | ||
) | ||
|
||
# Handle traditional format (continuous digits) | ||
if not qt_ver.isdigit(): | ||
return None | ||
|
||
if is_preview: | ||
return Version( | ||
major=int(qt_ver[:1]), | ||
major=int(qt_ver[0]), | ||
minor=int(qt_ver[1:]), | ||
patch=0, | ||
prerelease=("preview",), | ||
) | ||
elif len(qt_ver) >= 4: | ||
return Version(major=int(qt_ver[:1]), minor=int(qt_ver[1:3]), patch=int(qt_ver[3:])) | ||
return Version(major=int(qt_ver[0]), minor=int(qt_ver[1:3]), patch=int(qt_ver[3:])) | ||
elif len(qt_ver) == 3: | ||
return Version(major=int(qt_ver[:1]), minor=int(qt_ver[1:2]), patch=int(qt_ver[2:])) | ||
return Version(major=int(qt_ver[0]), minor=int(qt_ver[1]), patch=int(qt_ver[2])) | ||
elif len(qt_ver) == 2: | ||
return Version(major=int(qt_ver[:1]), minor=int(qt_ver[1:2]), patch=0) | ||
return Version(major=int(qt_ver[0]), minor=int(qt_ver[1]), patch=0) | ||
|
||
raise ValueError("Invalid version string '{}'".format(qt_ver)) | ||
|
||
|
||
|
@@ -213,10 +249,15 @@ class ArchiveId: | |
"mac": ["android", "desktop", "ios"], | ||
"linux": ["android", "desktop"], | ||
"linux_arm64": ["desktop"], | ||
"all_os": ["qt"], | ||
"all_os": ["wasm", "qt"], | ||
} | ||
EXTENSIONS_REQUIRED_ANDROID_QT6 = {"x86_64", "x86", "armv7", "arm64_v8a"} | ||
ALL_EXTENSIONS = {"", "wasm", "src_doc_examples", *EXTENSIONS_REQUIRED_ANDROID_QT6} | ||
ALL_EXTENSIONS = { | ||
"", | ||
"wasm", | ||
"src_doc_examples", | ||
*EXTENSIONS_REQUIRED_ANDROID_QT6, | ||
} | ||
|
||
def __init__(self, category: str, host: str, target: str): | ||
if category not in ArchiveId.CATEGORIES: | ||
|
@@ -239,6 +280,8 @@ def is_tools(self) -> bool: | |
return self.category == "tools" | ||
|
||
def to_os_arch(self) -> str: | ||
if self.host == "all_os": | ||
return "all_os" | ||
return "{os}{arch}".format( | ||
os=self.host, | ||
arch=( | ||
|
@@ -256,6 +299,7 @@ def to_extension_folder(self, module, version, arch) -> str: | |
extarch = "x86_64" | ||
elif self.host == "linux_arm64": | ||
extarch = "arm64" | ||
|
||
return "online/qtsdkrepository/{osarch}/extensions/{ext}/{ver}/{extarch}/".format( | ||
osarch=self.to_os_arch(), | ||
ext=module, | ||
|
@@ -276,25 +320,33 @@ def to_url(self) -> str: | |
|
||
def to_folder(self, version: Version, qt_version_no_dots: str, extension: Optional[str] = None) -> str: | ||
if version >= Version("6.8.0"): | ||
return "{category}{major}_{ver}/{category}{major}_{ver}{ext}".format( | ||
category=self.category, | ||
major=qt_version_no_dots[0], | ||
ver=qt_version_no_dots, | ||
ext="_" + extension if extension else "", | ||
) | ||
else: | ||
return "{category}{major}_{ver}{ext}".format( | ||
category=self.category, | ||
major=qt_version_no_dots[0], | ||
ver=qt_version_no_dots, | ||
ext="_" + extension if extension else "", | ||
) | ||
if self.target == "wasm": | ||
# Qt 6.8+ WASM uses a split folder structure | ||
folder = f"qt{version.major}_{qt_version_no_dots}" | ||
if extension: | ||
folder = f"{folder}/{folder}_{extension}" | ||
return folder | ||
else: | ||
base = f"qt{version.major}_{qt_version_no_dots}" | ||
return f"{base}/{base}" | ||
Comment on lines
+338
to
+340
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is different than previous code. Your code
|
||
elif version >= Version("6.5.0") and self.target == "wasm": | ||
# Qt 6.5-6.7 WASM uses direct wasm_[single|multi]thread folder | ||
if extension: | ||
return f"qt{version.major}_{qt_version_no_dots}_{extension}" | ||
return f"qt{version.major}_{qt_version_no_dots}" | ||
# Pre-6.8 structure for non-WASM or pre-6.5 structure | ||
return "{category}{major}_{ver}{ext}".format( | ||
category=self.category, | ||
Comment on lines
+348
to
+349
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The category handling is a bit different for >= 6.8.0 non-wasm, category is now assumed to be qt in that case. category is either tools or qt. Is there any case where the directory component is tools{major}_{ver}{ext}, either before or after 6.8.0? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This return is there for the legacy versions. For Qt 6.8 non-WASM, this is returned: base = f"qt{version.major}_{qt_version_no_dots}"
return f"{base}/{base}" All tests pass with this |
||
major=qt_version_no_dots[0], | ||
ver=qt_version_no_dots, | ||
ext="_" + extension if extension else "", | ||
) | ||
|
||
def all_extensions(self, version: Version) -> List[str]: | ||
if self.target == "desktop" and QtRepoProperty.is_in_wasm_range(self.host, version): | ||
return ["", "wasm"] | ||
elif self.target == "desktop" and QtRepoProperty.is_in_wasm_threaded_range(version): | ||
return ["", "wasm_singlethread", "wasm_multithread"] | ||
elif self.target == "wasm" and QtRepoProperty.is_in_wasm_threaded_range(version): | ||
return ["wasm_singlethread", "wasm_multithread"] | ||
elif self.target == "android" and version >= Version("6.0.0"): | ||
return list(ArchiveId.EXTENSIONS_REQUIRED_ANDROID_QT6) | ||
else: | ||
|
@@ -419,6 +471,10 @@ def dir_for_version(ver: Version) -> str: | |
|
||
@staticmethod | ||
def get_arch_dir_name(host: str, arch: str, version: Version) -> str: | ||
""" | ||
Determines the architecture directory name based on host, architecture and version. | ||
Special handling is done for mingw, MSVC and various platform-specific cases. | ||
""" | ||
if arch.startswith("win64_mingw"): | ||
return arch[6:] + "_64" | ||
elif arch.startswith("win64_llvm"): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ retry_backoff: 0.1 | |
max_retries_on_checksum_error: 5 | ||
max_retries_to_retrieve_hash: 5 | ||
hash_algorithm: sha256 | ||
INSECURE_NOT_FOR_PRODUCTION_ignore_hash: False | ||
INSECURE_NOT_FOR_PRODUCTION_ignore_hash: True | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Kidev You accidentally changed this in 7a2a41b. Also maybe worth cleaning up the commits from earlier so it doesn't clutter the history. Let me show you something, maybe it's obvious, but I didn't know GitHub Desktop had a "Reorder Commit" feature until just recently. I find it quite powerful because it's kind of an alternate way to interactive rebase, when used in combination with squash. To be honest I've never figured out how to do a real interactive rebase, I used to get so annoyed with it I would just hard reset back to some point and then cherry-pick back in and amend stuff as I go 🤣. I was amazed when I figured out the reorder/squash trick. Screen.Recording.2024-12-19.at.11.11.58.PM.movThere was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I usually don't squash in PR because I either squash merge, so it's squashed later and the branch keeps all history during the PR which is always nice, or I merge without rebase, so the history of main is not cluttered either. And I reset when I want to trash the latest commits quickly and I'm alone on the branch I do everything using the CLI though, I'm used to it. You even have all the commands to use when you enter the interactive mode: # Commands:
# p, pick <commit> = use commit
# r, reword <commit> = use commit, but edit the commit message
# e, edit <commit> = use commit, but stop for amending
# s, squash <commit> = use commit, but meld into previous commit
# f, fixup [-C | -c] <commit> = like "squash" but keep only the previous
# commit's log message, unless -C is used, in which case
# keep only this commit's message; -c is same as -C but
# opens the editor
# x, exec <command> = run command (the rest of the line) using shell
# b, break = stop here (continue rebase later with 'git rebase --continue')
# d, drop <commit> = remove commit
# l, label <label> = label current HEAD with a name
# t, reset <label> = reset HEAD to a label
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
# create a merge commit using the original merge commit's
# message (or the oneline, if no original merge commit was
# specified); use -c <commit> to reword the commit message
# u, update-ref <ref> = track a placeholder for the <ref> to be updated
# to this position in the new commits. The <ref> is
# updated at the end of the rebase
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
# You can do everything you want with that. Change the order of commits, change past commits... |
||
|
||
[mirrors] | ||
trusted_mirrors: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes of lines 234-238 are purely clarity related. They are equivalent but easier to read. For the line 236, it may appear that
qt_ver[2:]
is not equal toqt_ver[2]
, but it is since in this branch we know thatlen(qt_ver) == 3
.