Commit Graph

214 Commits

Author SHA1 Message Date
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
Hiroshi Miura
cb7eaeeb2a Update 64bit python detection
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2022-02-11 11:00:27 +09:00
David Dalcino
8a289e922c Merge remote-tracking branch 'upstream/master' into fix-archives-flag 2021-12-13 18:17:17 -08:00
Hiroshi Miura
f86f6aa321 Explicit triggering garbage collection
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-12-07 20:32:09 +09:00
Hiroshi Miura
38cf9cbcef Limit maxtasksperchild=1 for pool on 32bit python
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-12-07 20:11:16 +09:00
Hiroshi Miura
9833124237 Set maxtasksperchild=1 for download and extraction pool
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-12-07 17:08:34 +09:00
David Dalcino
633cbacc62 Update docs and help text for --archives 2021-12-05 11:53:42 -08:00
David Dalcino
05cc2347c7 Merge branch 'master' into topic-fix-453 2021-11-24 22:01:27 -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
db4db6c9a4 Implement --archive-dest feature 2021-11-24 13:30:48 -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
678387ccad Fix help text for list-see 2021-11-23 15:17:36 -08:00
David Dalcino
d9733363bc remove --modules flag from install-src 2021-11-23 11:10:14 -08:00
David Dalcino
6d1ff77cd4 Change target param for install-src/doc/example
This changes the CLI so that the `target` parameter for `install-src`,
`install-doc`, and `install-example` is now ignored, and "desktop" is
substituted for anything the user inputs. The only valid option here
is "desktop" anyway, so the user should be forgiven for trying to input
anything else.

It may be better to remove `target` from the parameter list, but that's
a big change to the interface that could break a lot of dependent code.
2021-11-23 11:10:10 -08:00
David Dalcino
e6cd276e20 Add impl of list-src/doc/examples 2021-11-23 11:08:11 -08:00
David Dalcino
621cd7a6c0 Fix implementation of aqt tool
This modifies `aqt tool` to allow `-` characters in tool versions, so
that `aqt tool` can pass the same unit tests that `install-tool` can.
This makes it less like the `aqt tool` from v1.2.5, but it should work
better with more tools with different version formats.
2021-10-30 19:23:35 -07:00
David Dalcino
ea55f2c8a7 fix broken install-tool (#442) 2021-10-30 16:23:33 -07:00
David Dalcino
173fbb9b6b Add suggestion on MemoryError to use external 7z 2021-10-29 11:08:15 -07:00
David Dalcino
bc1205945c Move _set_arch call before _determine_version 2021-10-28 15:42:43 -07:00
David Dalcino
4ab854291b Allow Cli._set_arch to receive SimpleSpec 2021-10-28 15:42:10 -07:00
David Dalcino
46fc2aaf9f Cause --noarchives to omit the base Qt module 2021-10-20 19:32:36 -07:00
David Dalcino
d5213142a8 Fix misuse of disable_socket (#415)
In an earlier PR, I added calls to `disable_socket()` from
`pytest_socket` where I thought they were needed to prevent some tests
from accessing the network, in case they weren't monkeypatched properly.
Today, I discovered that `disable_socket()` disables sockets globally
for all tests, which means that the tests that use remote data cannot
run if they are executed after another test calls `disable_socket()`.

This change calls `disable_socket()` once from `conftest.py`, so that
no tests are allowed to use network data unless they are marked as ok
to use the network, with `@pytest.mark.enable_socket`. See example of
usage in `tests/test_connection.py`.

Changed return code for unexpected exceptions:

This allows us to write tests that can discover whether an unexpected
exception occurred just by checking the return code, rather than reading
stderr. This will allow us to write less friable tests that don't break
every time some insignificant output details change.

This change catches exceptions derived from Exception and
KeyboardInterrupt raised by `installer`, while run by multiple
processes, and propagates them back to earlier stack entries. This will
prevent any OSError and BrokenPipe exceptions that would otherwise be
raised when one process has an exception while the other processes are
still running.

This also handles the MemoryError exception we saw in #416, and offers
some suggestions for solving the issue.
2021-10-05 14:40:05 +09:00
David Dalcino
4b99ee5755 Allow retry of download on checksum error 2021-10-03 16:13:35 -07:00
Hiroshi Miura
4eed29fdf1 Merge pull request #419 from ddalcino/allow-multiprocessing-error-propagation
Propagate exceptions from `run_installer()`
2021-10-03 01:06:44 -07:00
David Dalcino
23f2c89fe4 flake8 2021-10-02 18:37:59 -07:00
David Dalcino
776ab6181f Propagate exceptions from run_installer()
This change catches exceptions derived from Exception and
KeyboardInterrupt raised by `installer`, while run by multiple
processes, and propagates them back to earlier stack entries. This will
prevent any OSError and BrokenPipe exceptions that would otherwise be
raised when one process has an exception while the other processes are
still running.

This also handles the MemoryError exception we saw in #416, and offers
some suggestions for solving the issue.
2021-10-02 18:26:03 -07:00
David Dalcino
3b82bfc3f4 Print working dir and aqt version in error msg
Fix #417
2021-10-02 16:24:39 -07:00
David Dalcino
c5b89f6170 fail on mismatched tool versions
This recreates the legacy behavior, where `aqt tool` would fail to
install a tool variant when the version in the xml file does not match
the version requested in cli arguments.

This also recreates a bug where `aqt tool` cannot install tools that
do not have a valid semantic version.
2021-09-30 19:15:32 -07:00
David Dalcino
5961b4b478 Refactor parser creation
This reduces code duplication, with the intent of initializing the
parsers more consistently.

Why:
In #413, it was discovered that the interface of `aqt tool` did not
match the stated interface in the v1.2.5 documentation. After that,
I found that the interface for `aqt examples` and `aqt src` did not
fit that documentation either. This refactor places all of the
interface definitions in one location, with common code paths to
create each parser. This removes most of the code duplication involved
here, so that each parser is built more consistently. It also makes
it easier to visually inspect the differences between the parsers.
2021-09-30 17:24:41 -07:00
David Dalcino
d2a361b590 Fix aqt tool command 2021-09-30 14:34:19 -07:00
Hiroshi Miura
099b03d2e6 Merge pull request #402 from ddalcino/add-suggestion-modules-missing
Add helpful error messages when modules/tools/Qt version does not exist
2021-09-26 12:43:42 +09:00
David Dalcino
bf61de5800 Fix list-qt help formatting 2021-09-20 19:08:08 -07:00
David Dalcino
7104dbcdf7 Merge remote-tracking branch 'upstream/master' into add-list-qt-archives 2021-09-20 18:49:46 -07:00
David Dalcino
54c712bcf1 Move exception handling out of metadata 2021-09-20 13:13:02 -07:00
David Dalcino
7f256a252c Add interface to fetch modules 2021-09-17 14:49:05 -07:00
David Dalcino
4099b75121 black 2021-09-17 08:32:49 -07:00
David Dalcino
78ae876d9d implement CLI for --archives flag 2021-09-17 08:32:49 -07:00
David Dalcino
9c524c23ae Add metavar to improve help readability 2021-09-09 11:19:05 -07:00
David Dalcino
8592c0cc7a Improve readability of Cli._determine_qt_version
In this case, I think the functional solution is less readable than the
iterative solution, so I have removed the use of functools.reduce.
2021-09-09 11:08:18 -07:00
David Dalcino
8f8fc6d4c5 Fix failing test for KDE patch 2021-09-09 11:03:03 -07:00
David Dalcino
1a918c35c5 Merge remote-tracking branch 'upstream/master' into specify-version-by-simplespec 2021-09-09 08:26:10 -07:00
David Dalcino
65293b82ee Implement install-qt by spec 2021-09-07 14:34:26 -07:00
David Dalcino
57f4224d2c Add a catch-all exception handler to Cli.run
This catch-all exception handler will catch anything derived from
Exception, but not BaseException. It will catch every exception that we
have not explicitly wrapped in an AqtException, which means it will
catch every error we did not anticipate. It prints a stacktrace and asks
the user to submit a bug report.
2021-09-02 10:46:15 -07:00
David Dalcino
88c30d90d0 Raise exceptions from existing exceptions 2021-09-02 09:57:34 -07:00
David Dalcino
50ced0aafe Add ArchiveExtractionError 2021-09-01 16:08:56 -07:00
David Dalcino
3de8f1e51a Refactor ArchiveConnectionError handling code 2021-09-01 12:37:20 -07:00
David Dalcino
772b74d3a3 Don't return unnecessary integers from args.func 2021-09-01 11:58:35 -07:00
David Dalcino
feeacf06de Raise on invalid version strings 2021-09-01 11:54:38 -07:00
David Dalcino
73b162d9aa Raise instead of exit(1) for simple cases 2021-09-01 11:52:38 -07:00
David Dalcino
eba366a5a9 Catch NoPackageFound exception properly 2021-08-25 15:04:16 -07:00