89 Commits

Author SHA1 Message Date
Arnaud de Mouhy
760691c535 Use dictionary's get 2025-10-13 16:54:47 +02:00
Arnaud de Mouhy
d9b6f1a747 Handle special mac arm64 official installer case 2025-10-13 15:32:15 +02:00
Alexandre 'Kidev' Poumaroux
c63fb870e6 Add --UNSAFE-ignore-hash option 2025-04-17 23:03:59 +02:00
Alexandre 'Kidev' Poumaroux
21d17952e8 Add timeout to request.get in get_qt_installers 2025-03-24 21:59:54 +01:00
Alexandre 'Kidev' Poumaroux
0ada55c475 Fix lint and tests 2025-03-23 02:49:14 +01:00
Alexandre 'Kidev' Poumaroux
4fdb75de3b Change syntax of extract_auth to work with python 3.9 2025-03-21 06:17:53 +01:00
Alexandre 'Kidev' Poumaroux
8d09f6550c Fetch installer names without hardcode, add get_os_arch to support arm64 for linux and windows 2025-03-21 03:59:38 +01:00
J.D. Purcell
a19e36e80d Fix error running official installer on macOS 2025-03-11 09:46:33 -04:00
Alex Spataru
bb20a686cf Fix download URL for official installer on macOS 2025-03-11 09:43:41 -04:00
Hiroshi Miura
3b9a1a98ae style: apply black
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2025-03-04 16:20:24 +09:00
Hiroshi Miura
122377cb8a refactor: removal of duplicated download_installer functionality
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2025-03-04 11:43:53 +09:00
Alexandre Poumaroux
5d699b9ebf Commercial fixes, CI tests, more tests, coverage (#883)
* Add authentication flags for list-qt-commercial, add tests for coverage

* Add dry run

* Make tests really use auth since secrets have been added, fix some indents

* Fix auth issue, rename user 'email, and password 'pw'

* Fix modules param type

* Update commands names
2025-02-22 09:56:56 +09:00
Alexandre Poumaroux
cbe159f38a Add support for commercial versions of Qt (#878)
* Add install-qt-commercial feature and tests

* Make the auto-answers parameters, fix linter issues

* Fork and execv instead of using subprocess

* Return to simpler process execution method version

* Fix test

* Move commercial installer into its own file

* Fix shadowing of symbol platform causing errors

* Adapt test_cli for argparse format changes on py 3.13+

* Fix some errors, monkeypatch install test

* Add --override super command

* Properly handle --override and grab all the remaining commands when no quotes are given

* Fix tests

* Add base for modules, some niche features are not yet entirely implemented, and there are no updates to the testsuite

* Fix some mistakes

* Fix errors made with the monkeypatch, update Settings to make sure its init

* Tests commercial (#20)

* Full support of installation of all modules and addons
* Add auto setup of cache folder for each OS, add unattended parameter
* Fix settings folders
* Add graceful error message for overwrite case

* Fix windows issue

* Hidden summon works

* Remove both subprocess direct calls

* Dipose of temp folder

* Fix path issue

* Add list-qt-commercial command

* Fix help info

* Make no params valid for list-qt-commercial

* Fix lint errors, and param overflow when no args are passed to list

* Fix search

* Add tests for coverage, fix lint

* Test for overwriting, and for cache usage coverage

* Return to clean exec, ignoring CI fail to preserve code clarity

* Fix parsing of subprocess.run output for some python versions

* Make output more readable in console for list-qt-commercial

* Forward email and password to list request for users without a qtaccount.ini

* Change default settings

* Fix lint errors

* Fix check error
2025-01-28 20:51:53 +09:00
Alexandre Poumaroux
a09b5cee28 Fix WASM (#846)
* Rewrite WASM support

* Add WASM tests to CI, update CI to test more the latest versions, add auto EMSDK version detection function

* Fix some mistakes, typos, moved emsdk version function into BuildJob

* Fix issue related to extensions interfering with wasm on 6.8+

* Fix tests

* Remove dep on Version in CI

* Remove safety before patch

* handle cases where extensions don't exist.

for example with windows desktop 6.8.1 win64_msvc2022_arm64_cross_compiled
both qtwebengine and qtpdf don't exist.

Signed-off-by: Alexandre 'Kidev' Poumaroux <1204936+Kidev@users.noreply.github.com>

* for --long-modules assume extension doesn't exist on download error.

Signed-off-by: Alexandre 'Kidev' Poumaroux <1204936+Kidev@users.noreply.github.com>

* for --modules assume extension doesn't exist for download failures.

Signed-off-by: Alexandre 'Kidev' Poumaroux <1204936+Kidev@users.noreply.github.com>

* reformat with black

Signed-off-by: Alexandre 'Kidev' Poumaroux <1204936+Kidev@users.noreply.github.com>

* fix flake8 regression that doesn't occur locally.

Signed-off-by: Alexandre 'Kidev' Poumaroux <1204936+Kidev@users.noreply.github.com>

* Fix autodesktop by also updating the OS when searching for a valid desktop version to download

* Fix extension issue, reduce the possible retry for getting extensions to prevent server spam

* Fix CI asking for msvc2019 on 6.8+ but its no longer supported

* Make CI use C++20 and MSVC2022

* Fix linux build

* Update runners to windows-2022

Signed-off-by: Alexandre 'Kidev' Poumaroux <1204936+Kidev@users.noreply.github.com>

* Fix patching

Signed-off-by: Alexandre 'Kidev' Poumaroux <1204936+Kidev@users.noreply.github.com>

* Add back the semantic version changes to prevent crashes, add tests for it

* Update checks

* Cast 'https://mirrors.ustc.edu.cn' to the shadow realm

* Again

* Update settings.ini

* Update settings.ini

* Update settings.ini

* Remove one_rep on silent

* Update settings.ini

* Restore master settings, remove hash check

* ci: Use specific mirror

Attempt to work around download errors in Azure due to Qt's official download site often redirecting to mirrors to which the network connection is unstable

Signed-off-by: Alexandre 'Kidev' Poumaroux <1204936+Kidev@users.noreply.github.com>

* Re enable hash checking

* Treat read timeout error during download as connection error

Signed-off-by: Alexandre 'Kidev' Poumaroux <1204936+Kidev@users.noreply.github.com>

* Add test for modules in WASM with autodesktop

* Fix format

* Fix test

* Make '--autodesktop' trigger its own install process, and test it

* Fix older autodesktop tests

* Add mock update files for 680 wasm, add test for wasm 680 autodesktop

* Passes the additional tests

* Fix format

* Improve coverage, fix format

* Fix tests and improve logging or install

* Fix format

* Fix regression in other tests

* Use flavor

* Fix line len

* Fix codeql

* Fix list-qt for WASM arch on 6.5.x and 6.6.x, restore to original download URL

* Fix test error

* Revert ci settings URL as it is never used by clients, only in CI

* Add comment for clarity in ci/settings.ini

---------

Signed-off-by: Alexandre 'Kidev' Poumaroux <1204936+Kidev@users.noreply.github.com>
Co-authored-by: tsteven4 <13596209+tsteven4@users.noreply.github.com>
Co-authored-by: J.D. Purcell <jdpurcell@gmail.com>
2025-01-06 15:35:40 +09:00
Hiroshi Miura
eb164e552b Improve type definitions and styles (#869)
- exclude .reviewdog.yml from source distribution
- Add more type hints
- protective check for self.config in SettingsClass

Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2024-12-24 14:45:04 +09:00
tsteven4
3f2f59d488 appease mypy Version no-untyped-call (#864)
* appease mypy Version no-untyped-call

Without the type hint we get:
error: Call to untyped function "Version" in typed
context  [no-untyped-call]

Note that our Version is derived from semantic_version, which
doesn't have type hints.

* mark class definition __init__ functions -> None.

This prevents reviewdog from generating an no-untyped-call warning
when a new instance of the class is created.  This behavior is
a time bomb.  reviewdog flags the warning at the line the new instance
was added, which is within the scope of the diffs, but the problem lies
elsewhere, in the class definition.

* fix mypy import-untyped error.
2024-12-21 10:02:21 +09:00
Hiroshi Miura
65e760383f fix: remove logic to check combination
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2024-08-05 08:00:32 +09:00
Hiroshi Miura
74963f9d87 fix: remove unused json
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2024-08-04 21:32:53 +09:00
Hiroshi Miura
d0260e035a fix: delete combination check
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2024-08-04 16:12:19 +09:00
lebarsfa
612dc7ba91 Add ignore_hash option in settings.ini (#684)
* Settings: add an option to skip checksum verification on Updates.xml

This allows aqt to work even when the server download.qt.io is
unreachable.

Signed-off-by: Alberto Mardegan <mardy@users.sourceforge.net>

* Update settings.ini

* Correct option to skip checksum verification

* Rename ignore_hash option to INSECURE_NOT_FOR_PRODUCTION_ignore_hash

* Update doc about INSECURE_NOT_FOR_PRODUCTION_ignore_hash

* Add hash_algorithm option

* Unofficial mirrors might not provide any hash for Updates.xml

* docs: update configuration.rst

express default value of hash_algorithm

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* fix: hashlib constructor with usedforsecurity=False

- Python 3.9 and later introduce a keyword argument ``usedforsecurity``
- Set to False because we use hash to check file integrity not for password hash.

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* Attempt to fix parameter type inconsistency in downloadBinaryFile

---------

Signed-off-by: Alberto Mardegan <mardy@users.sourceforge.net>
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
Co-authored-by: Alberto Mardegan <mardy@users.sourceforge.net>
Co-authored-by: Hiroshi Miura <miurahr@linux.com>
2023-11-06 07:29:03 +09:00
Hiroshi Miura
0f1010baee Load settings.ini in child process
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2022-12-05 19:50:51 +09:00
Hiroshi Miura
e8bea204bd Use borg for Settings class
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2022-12-05 19:50:50 +09:00
Hiroshi Miura
1dbd73450a Adjust code scanner warnings
- Replace map+filter and list+filter with list comprehension expression
- Use try/except for next(Iterator)
- Add test case for altlink that cause exception on next() in get_altlink
- Avoid exit but use sys.exit

Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2022-11-21 07:34:45 +09:00
Dave Dalcino
452f8d74b2 Fix mypy type errors
- Introduce classes inherit argparse.ArgumentParser to suppress mypy
  errors in Cli class.
- `requests.session.Session.get()` expects that `timeout` is `float | tuple[float, float] | tuple[float, None] | None`
  so use `Tuple[float, float]` for timeout
- Use named tuple for modules_query
- Update test_list.py
2022-11-21 07:34:45 +09:00
Hiroshi Miura
c1627a9686 mypy: update untyped defs
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2022-11-20 15:20:27 +09:00
Dave Dalcino
81eebde168 Adjust against mypy type errors 2022-11-20 15:20:27 +09:00
Dave Dalcino
f407cfe37b Implementation for aqt list-qt --long-modules 2022-08-08 17:49:05 -07:00
David Dalcino
dc45839df4 Fix implementation of helper.get_hash
Causes `get_hash` to verify the hash length, and check that the hash can
be unhexlified properly.

Fixes the interface for `get_hash` so that the caller does not have to
run `binascii.unhexlify` or verify its output.
2022-03-20 14:16:24 -07:00
David Dalcino
5ad7c1a058 Use defusedxml to parse Updates.xml files
I don't think we can really call the `Updates.xml` files that we are
parsing 'untrusted xml', because we are checking that they match the
sha256 checksum. However, I don't think there's any good reason not to
use a more secure parsing algorithm.
2022-03-10 17:23:58 -08:00
David Dalcino
12d20a3d06 Fix failure to use fallback for getlist
aqt.helper.MyConfigParser.getlist fails to retrieve a fallback list when
the `section` parameter does not exist in the `settings.ini` file.
This ensures that the fallback is used when that key is missing.
2022-03-06 17:56:26 -08:00
David Dalcino
f979d80899 WIP use checksums for updates.xml files 2022-03-06 17:56:25 -08:00
David Dalcino
2c5c261592 It's no secret that we need a random number! 2022-03-06 17:36:33 -08:00
David Dalcino
96af3eb393 Refactor: split QtArchive.archive_url into parts
This splits QtArchive.archive_url into two new datamembers: archive_path
and base_url. Ultimately, base_url should be removed from QtPackage
entirely.
2022-03-06 17:36:32 -08:00
David Dalcino
7ebd6aa34e Use sha256 hashes only from trusted mirrors
To keep this commit small, `hashurl` was removed from QtPackage, and
`get_hash` constructs the hash url based on the url of the 7z archive
to download. I think that in the future, QtArchive and QtPackage could
be refactored to construct this url more appropriately. However, this
would be a complicated change that doesn't belong in this commit.
2022-03-06 17:36:32 -08:00
David Dalcino
b92ee9935d Add setting for trusted_mirrors 2022-03-06 17:36:32 -08:00
Hiroshi Miura
2dae2fcf71 Merge pull request #479 from miurahr/topic-update-xml-delimiter-wo-space
Accept Update.xml that use comma without space as delimiter
2022-01-13 15:45:22 +09:00
Hiroshi Miura
9b66f03718 Accept Update.xml that use comma without space as delimiter
resolve #475

Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2022-01-12 22:24:16 +09:00
Hiroshi Miura
948fb18650 Test: helper: update mock for requests.sessions.Session
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2022-01-11 20:36:34 +09:00
Hiroshi Miura
87f95ddc59 Fix behavior that getUrl() does not retry
getUrl() now use `requests.get()` that is default getter that does not retry.
This change corrects it to `session.get()`

Related issue #472

Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2022-01-11 15:22:29 +09:00
David Dalcino
d6a6f79740 Prevent listing modules <= 40 bytes uncompressed
This prevents `list-*` from printing any module whose uncompressed size
is 40 bytes or less.

I have found a couple of modules that are exactly 40 bytes, and they
include no files, only empty directories. If any user tries to install
these modules, they will think that aqt failed to install the module
without printing any error message. I prefer to avoid this issue
by preventing `aqt list-*` from printing them.

`aqt install-*` is unaffected by this change, and it can still install
modules that contain no files. It is likely that we will need to print
a warning when this occurs.

If any user disagrees with the threshold value of 40 bytes, they are
free to adjust that value to their liking in `settings.ini`.
2021-11-26 14:04:10 -08:00
David Dalcino
7d5ee32ac3 Add settings entries for --keep & --archive-dest
This allows a user to turn on `--keep` every time they run the program,
and to set the default archive destination when `--keep` is turned on.
Using `--archive-dest` overrides the archive destination in setting.ini.
2021-11-24 14:01:26 -08:00
David Dalcino
3af9c97ba0 Refactor: Allow modifiable download dest path
This adds the parameter `archive_dest` to `run_installer`, which will
control where `helper.downloadBinaryFile` will download files, and sets
it to "." by default.

For convenience/readability, this will also turn any reference to the
downloaded file into a `pathlib.Path` object. This makes it easier to
ensure that the file ends up in the right location.
2021-11-24 13:29:20 -08:00
David Dalcino
be72b00bfc Add max_retries_on_connection_error
This change deprecates the `max_retries` option in settings.ini,
replacing it with `max_retries_on_connection_error`, in order to
differentiate it from `max_retries_on_checksum_error`.
2021-10-04 08:04:57 -07:00
David Dalcino
a06ba49e63 Improve ArchiveChecksumError error message 2021-10-04 07:42:06 -07:00
David Dalcino
4b99ee5755 Allow retry of download on checksum error 2021-10-03 16:13:35 -07:00
David Dalcino
f037a96457 Raise ArchiveListError where appropriate 2021-09-17 09:53:35 -07:00
David Dalcino
ddd6c64628 Simplify xml_to_modules
helper.xml_to_modules had a `keys_to_keep` parameter that was unused
and not really necessary, since the caller can filter the keys easily.
2021-09-17 09:52:33 -07:00
David Dalcino
f6761a0b54 Reorganize downloadBinaryFile exceptions
This change separates the handling of hash mismatches from all other
exceptions.

The functions in the `try` block (open, iter_content, write, update,
flush) can generate a wide variety of exceptions with no common base
class other than Exception. It would be my preference to differentiate
between file IO exceptions, hash update errors, and input stream errors,
but it seems impractical to track down all the different types. For that
reason, I am wrapping the base Exception type in an
ArchiveDownloadError. I am removing the `exc=sys.exc_info()` and
`logger.error(exc[1])` because it's redundant. `sys.exc_info()[1]`
returns the current exception being handled, which is `e`.
2021-09-02 10:21:05 -07:00
David Dalcino
88c30d90d0 Raise exceptions from existing exceptions 2021-09-02 09:57:34 -07:00
David Dalcino
01f078161e Add setting to turn on stack trace in output 2021-09-01 11:45:18 -07:00