miurahr / aqtinstall

aqt: Another (unofficial) Qt CLI Installer on multi-platforms
https://aqtinstall.readthedocs.io/en/latest/
MIT License
911 stars 84 forks source link

[Bug]: exception in list-qt for android target #817

Open BenCrafterRED opened 2 weeks ago

BenCrafterRED commented 2 weeks ago

Bug description

Run aqt list-qt <TARGET> android. Where <TARGET> is one of linux, mac, windows.

The command crashes without any useful information provided to the user. Other list-* commands seem to work.

Tested in virtual environment and system-wide pip install which both result in the same behavior.

Expected behavior

A list of Qt versions.

aqt and python version

aqtinstall(aqt) v3.1.18 on Python 3.12.3 [CPython GCC 13.2.0]

Operating System

Linux/Unix

Relevant log output

ERROR   : Invalid version string '7'
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/dist-packages/aqt/installer.py", line 182, in run
    args.func(args)
  File "/usr/local/lib/python3.12/dist-packages/aqt/installer.py", line 663, in run_list_qt
    show_list(meta)
  File "/usr/local/lib/python3.12/dist-packages/aqt/metadata.py", line 1005, in show_list
    output = meta.getList()
             ^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/aqt/metadata.py", line 620, in getList
    return self._action()
           ^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/aqt/metadata.py", line 657, in fetch_versions
    versions = sorted([ver for ver, ext in versions_extensions if ver is not None and filter_by(ver, ext)])
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/aqt/metadata.py", line 784, in folder_to_version_extension
    get_semantic_version(qt_ver=ver, is_preview="preview" in ext),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/aqt/metadata.py", line 197, in get_semantic_version
    raise ValueError("Invalid version string '{}'".format(qt_ver))
ValueError: Invalid version string '7'
ERROR   : aqtinstall(aqt) v3.1.18 on Python 3.12.3 [CPython GCC 13.2.0]
Working dir: `/home/user`
Arguments: `['/usr/local/bin/aqt', 'list-qt', 'linux', 'android']` Host: `uname_result(system='Linux', node='ubuntumatepc', release='6.8.0-41-generic', version='#41-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug  2 20:41:06 UTC 2024', machine='x86_64')`
===========================PLEASE FILE A BUG REPORT===========================
You have discovered a bug in aqt.
Please file a bug report at https://github.com/miurahr/aqtinstall/issues
Please remember to include a copy of this program's output in your report.

Code of Conduct

ddalcino commented 2 weeks ago

Looks like the Qt maintainers changed the directory structure, again.

Incomplete listing of directories at https://download.qt.io/online/qtsdkrepository/linux_x64/android/:

Currently, the following code splits up the folder name on _, and the string of digits following qt5 or qt6 is interpreted as the version of Qt. So, 51212 gets split up into 5.12.12 and 600 gets split up into 6.0.0. However, qt6_7_3 gets mangled, because aqt thinks that 7 is the whole version string, when it actually refers to version 6.7.3.

https://github.com/miurahr/aqtinstall/blob/73fc45e12a0a8e2e417fee12b6813b6a82dc9324/aqt/metadata.py#L779-L786

Also see get_semantic_version_string here: https://github.com/miurahr/aqtinstall/blob/73fc45e12a0a8e2e417fee12b6813b6a82dc9324/aqt/metadata.py#L172-L197

Please also note that this means it is currently impossible to install Qt 6.7.* for Android without using the all_os directory, because the installer won't be able to find these folders either.