-
-
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
Add support for commercial versions of Qt #878
base: master
Are you sure you want to change the base?
Conversation
️✅ There are no secrets present in this pull request anymore.If these secrets were true positive and are still valid, we highly recommend you to revoke them. 🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request. |
7807a12
to
d5ab8a6
Compare
d5ab8a6
to
1fe3990
Compare
Important Everything works well, and I added tests. It still lacks supports for specific addons right now, I'm working on it. Note With current settings, I cannot complete subprocess.run(["qt-unified-linux-x64-online.run"].extend(arguments), shell=False, check=True, cwd=working_dir) I even tried the old school fork/exec way using os.execv("qt-unified-linux-x64-online.run", ["qt-unified-linux-x64-online.run"] + arguments) |
👍 Nice job! With this feature, the functionality of aqtinstall will be more completed! I think this can also help @ddalcino's aqt list-qt server: https://github.com/ddalcino/aqt-list-server/blob/3ae82fa442453563063a3ea95adc0e4c4261831b/src/App.tsx#L180-L195 |
Lines 213 to 217 in 7917b2d
Line 99 in 7917b2d
Hmm, how did those lines get accepted...? I don't think they are fully "static". |
Thanks ! It may, the goal of this feature is to allow direct access to the Qt installer, breaking all the potential limitations the Qt team may bring to third parties, while still benefiting from the better aqtinstall's syntax and tools
And yes indeed, in fact you can check here all the issues reported for the project, there are other critical ones. I think it's due to the fact that Codacy was added recently. Coupled with the fact that it must be configured on their website and not using a config file on the repo, and that is why I cannot get passed this ONE fail for now. It really tickles my brain but my time is better spent working on more useful features like the addons support aha |
Well I relapsed, and wasted some more time. Now I'm 100% certain there is no way around this. This The solution hinted at on the site is either mentioning a function that do not exist, or serving AI slop solutions, looping between two opposite solutions that just change what the other did in a very gas lighting way. My solution: @miurahr please in your interface, go to https://app.codacy.com/gh/miurahr/aqtinstall/patterns and disable And this one click makes the CI pass on my fork Note there will still be a warning for this case, but it won't trigger a CI failure. Maybe I'm oversensitive to those, very likely even. But removing some of those overly pedantic/punitive Also note that this one change makes the |
I agree. I haven't tested this, but I imagine this will fix a lot of the issues we have with patching new releases, etc. This new command is a huge improvement.
It is helpful. Not sure I have the bandwidth to fix it at the moment though.
IMHO, I disagree. I think it's better to just accept that these issues are false positives, and merge the PR anyway. There's probably still some value to be had from keeping the semgrep tool enabled; it just shouldn't be a blocker to merging this. Personally, I think the more worrying CI report is this one:
Large coverage decreases like this can make the project a lot harder to maintain successfully. I'm not in charge, but if I were, I would ask you to add tests to get the coverage decrease as close to 0% as possible. I'd also ask for one Azure Pipeline build job, just to prove that the new command can built a sample Qt project successfully. I think one is enough for now. |
The platform does provide solution, but useless? Well, AI-ish stuff again...
I agree. Humans are working with tools. |
Oh! I didn't see this part. If we still get the warnings after turning off semgrep, maybe it's ok to turn it off. I retract my objection. |
40ed004
to
0790ad3
Compare
I agree @ddalcino, but guess why it decreased? Because I had to add so many branches just to prove to one CI tool that I was a good boy, and that my process spwan was safe. And testing all those cases is impossible unless you have an army with you. Right now it is I agree it's just a tool, but don't underestimate the effect of hundreds of red error lines on a tired dev morale. Codacy yields stupidities like Take a look at the number of edits I made to the main post of the PR. I'm a hopeless stage 4 perfectionist. I'm not sharing random untested code trust me, and I religiously follow the code guide lines of the project I help. But sometimes some tools have the opposite effect of what they want to achieve, and when that happens, I feel it is a duty to share my concerns with the maintainer. And I believe it is the case here. It's not an order in anyway, just a live report from the trenches. |
The feature proposed has an independence with other aqt installer features.
I agree the approach. It provides a consistency with install-qt command to help users, and support users to run unattended installation. |
It was my first way of doing it, in a new commercial.py file. However I had issues with the import of other aqt modules not being available yet or something like this. So I went for the easy way to do it and put it all in install.py. But yea at the very least the CommercialInstaller class should live in its own file |
OK, Lets merge here as is. When someone want to refactor classes, it will have a chance to get its own file. |
I try to update a codacy check criteria and gate standard. |
c26c0e6
to
399acf0
Compare
Ok I am adding the parameter kidev:~$ python -m aqt install-qt-commercial --override "--root /home/kidev/override_test --accept-licenses --accept-obligations --confirm-command --auto-answer OperationDoesNotExistError=Ignore,OverwriteTargetDirectory=No,stopProcessesForUpdates=Cancel,installationErrorWithCancel=Cancel,installationErrorWithIgnore=Ignore,AssociateCommonFiletypes=Yes,telemetry-question=No install qt.qt6.681.linux_gcc_64" When present, it will ignore all other parameters and simply give its value(s) to the installer. It also works without quotes: kidev:~$ python -m aqt install-qt-commercial --override --root /home/kidev/override_test --accept-licenses --accept-obligations --confirm-command --auto-answer OperationDoesNotExistError=Ignore,OverwriteTargetDirectory=No,stopProcessesForUpdates=Cancel,installationErrorWithCancel=Cancel,installationErrorWithIgnore=Ignore,AssociateCommonFiletypes=Yes,telemetry-question=No install qt.qt6.681.linux_gcc_64 You have full control over the parameters of the binary with this, so you can launch the GUI if you want ( |
You could also do useful things like listing addons: kidev:~$ python -m aqt install-qt-commercial --override --accept-licenses --accept-obligations --confirm-command --default-answer search qt.qt6.681
INFO : aqtinstall(aqt) v0.1.dev1867 on Python 3.13.1 [CPython GCC 14.2.1 20240910]
INFO : Downloading Qt installer to /tmp/qt_install_4kjtb709/qt-unified-linux-x64-online.run
INFO : Running: /tmp/qt_install_4kjtb709/qt-unified-linux-x64-online.run --accept-licenses --accept-obligations --confirm-command --default-answer search qt.qt6.681
...
<availablepackages>
<package name="qt.qt6.681.addons.qtquick3dphysics" displayname="Qt Quick 3D Physics" version="6.8.1-0-202411221531"/>
<package name="qt.qt6.681.addons.qtpositioning" displayname="Qt Positioning" version="6.8.1-0-202411221531"/>
<package name="qt.qt6.681.addons.qt3d" displayname="Qt 3D" version="6.8.1-0-202411221531"/>
<package name="qt.qt6.681.addons.qtserialbus" displayname="Qt Serial Bus" version="6.8.1-0-202411221531"/>
<package name="qt.qt6.681.addons.qtconnectivity" displayname="Qt Connectivity" version="6.8.1-0-202411221531"/>
....
<package name="qt.qt6.681.addons.qtspeech" displayname="Qt Speech" version="6.8.1-0-202411221531"/>
<package name="qt.qt6.681.addons.qtgraphs" displayname="Qt Graphs" version="6.8.1-0-202411221531"/>
<package name="qt.qt6.681.addons.qtquickeffectmaker" displayname="Qt Quick Effect Maker" version="6.8.1-0-202411221531"/>
</availablepackages>
INFO : Qt installation completed successfully And finally, the temporary way to install modules (here QtQuick3D): kidev:~$ python -m aqt install-qt-commercial --override --accept-licenses --accept-obligations --confirm-command --default-answer install qt.qt6.681.linux_gcc_64 qt.qt6.681.addons.qtquick3d |
Major progress. Modules are available, but that required a few things. Note that --override remains, and its behavior almost did not change. Indeed, it is still entirely possible to use to call the installer binary directly. However now, if you do not add all the boilerplate flags to it, it will add it automatically. Those flags are also no longer parameters, but configs inside settings.ini: [qtcommercial]
# If False, it will require user inputs
# If True, it will append --accept-licenses --accept-obligations --confirm-command to the command
# Even if `--override` is provided
unattended = True
# Timeout for Qt installer operations (in seconds)
installer_timeout = 30
# Auto-answer settings for Qt installer
# Those will be translated into flags and passed to the installer automatically
# Even if `--override` is provided
operation_does_not_exist_error = Ignore
overwrite_target_directory = No
stop_processes_for_updates = Cancel
installation_error_with_cancel = Cancel
installation_error_with_ignore = Ignore
associate_common_filetypes = Yes
telemetry = No
# Cache path for Qt installer files
# This entry is absent from shared settings.ini, and auto updates on init if absent to be the most relevant folder possible given the OS
cache_path = ~/.cache/aqt To be entirely "free" while using override, you will have then to set Therefore, override commands can still achieve the same features, while being as simple as: kidev:~$ python -m aqt install-qt-commercial --override install qt.qt6.681.linux_gcc_64
kidev:~$ python -m aqt install-qt-commercial --override search qt6.681 You may have noticed the cache path setting. It is where aqt will save its cached module list. Since they do not change, it's perfect for caching. To get their content, aqt will call the search option of the official Qt installer, parse and save the content of that call. The next times, it wont search again. It is maybe possible to pull all those .json files and to distribute it with aqt. Undecided for now, @miurahr your call So, now you can use the --modules parameter. Like this: kidev:~$ python -m aqt install-qt-commercial desktop linux_gcc_64 6.8.1 --modules qtquick3d If the module kidev:~$ python -m aqt install-qt-commercial desktop linux_gcc_64 6.8.1 --modules all The cache is structured into folder and json file. For example: kidev:~/.cache/aqt/desktop/linux_gcc_64/6.8.1$ cat packages.json
[
{
"name": "qt.qt6.681.addons.qtimageformats",
"displayname": "Qt Image Formats",
"version": "6.8.1-0-202411221531"
},
{
"name": "qt.qt6.681.src",
"displayname": "Sources",
"version": "6.8.1-0-202411221531"
},
{
"name": "qt.qt6.681.debug_info",
"displayname": "Qt Debug Information Files",
"version": "6.8.1-0-202411221531"
},
{
"name": "qt.qt6.681.qtwaylandcompositor",
"displayname": "Qt Wayland Compositor",
"version": "6.8.1-0-202411221531"
},
{
"name": "qt.qt6.681.android",
"displayname": "Android",
"version": "6.8.1-0-202411221531"
},
{
"name": "qt.qt6.681.addons.qtspeech",
"displayname": "Qt Speech",
... |
…ented, and there are no updates to the testsuite
Important
Need testers with a commercial license of Qt, click here to see how to try this PR and help us greatly
Adds
install-qt-commercial
enabling the installation of commercial versions of Qt. It also enables open-source users to download Qt through the official Qt online installer.python -m aqt install-qt-commercial <target> <arch> <version> [--outputdir <path>] [--user <email> --password <pw>]
This command will download the official Qt installer, and translate
aqtinstall
commands you are used to into the arguments the official installer needs. It will automatically accept all licenses, the installation is unattended.It requires authentication, or it will fail, even if you use it to download open-source versions.
To authenticate:
It first looks into the folder of your OS where the file
qtaccount.ini
can be:C:\Users\<username>\AppData\Roaming\Qt\qtaccount.ini
/home/<username>/.local/share/Qt/qtaccount.ini
/Users/<username>/Library/Application Support/Qt/qtaccount.ini
This file is automatically created when you use the
MaintenanceTool
binary and log in using the GUI. You can simply copy the file that you have locally on your CI server, it will work accross platforms. Just treat it as a password. Refer to this page for more details.It will also check the value of the environment variable
QT_INSTALLER_JWT_TOKEN
and use the token if provided.If neither are present, you will need to provide
--user <email> --password <password>
.Note that if
--user
and--password
are provided, they will supersede theqtaccount.ini
and the JWT token account.Advanced configuration details
This installer will only be able to install Qt for the OS running the command: so you can only install a Windows version of Qt if you run it on Windows. This seems to be a limitation of the official Qt online installer.
Note that the installer will fail if the target directory is not empty. You can change the target install directory by providing
--outputdir <path>
.By default, the tool will auto answer various options. You can change those default values by passing parameters to
install-qt-commercial
. See this for more details.Work remaining
install-qt-action
. It already works but is limited by my progress on this PR for now. You can check the fork here. You can also check a workflow run where Qt was successfully installed using theuse-commercial
feature. The build did not succeed because there are no support for modules yet. The job used in the workflow is:For reference, this is equivalent to running the following command using Qt's online installer:
CLI Usage example
Click to see the full output
If you own a Qt commercial license
Important
If you do have a commercial license, please help us testing! You can easily try this PR in 5mn. You just need to install Git and Python 3.11+. Then simply enter the following commands in your console, line by line, and it should download Qt 5.15.3 for your OS: if it does, please report it. And if it fails, please report the errors you get
Win+R
, then typecmd
and pressEnter
to open the console)The parameters
user
andpassword
are not required if you already used Qt's MaintenanceTool GUI on your machine. If you did not, simply replace<email>
by your email or Qt username, and<pw>
by your Qt password.outputdir
is only needed if you have errors when trying to install in the default Qt path for your OSI do not have a paid Qt license, so I can only test it on open-source versions, but it should work as well on paid version since I'm directly using the Qt installer as intended.