Commit Graph

93 Commits

Author SHA1 Message Date
David Dalcino
253ff50845 Refactor xml fetch methods for easier reuse 2021-09-17 14:50:13 -07:00
David Dalcino
7f256a252c Add interface to fetch modules 2021-09-17 14:49:05 -07:00
David Dalcino
f037a96457 Raise ArchiveListError where appropriate 2021-09-17 09:53:35 -07:00
David Dalcino
4099b75121 black 2021-09-17 08:32:49 -07:00
David Dalcino
49cde4ee30 fix test error 2021-09-17 08:32:49 -07:00
David Dalcino
2318ca6a61 sort output 2021-09-17 08:32:49 -07:00
David Dalcino
b888cab8e4 add arguments length check 2021-09-17 08:32:48 -07:00
David Dalcino
8cc7979f46 Add suggested follow up for archives flag 2021-09-17 08:32:48 -07:00
David Dalcino
709f064ebb Implement fetch_archives 2021-09-17 08:32:40 -07:00
David Dalcino
3c15c56188 Refactor xml fetch methods for easier reuse 2021-09-17 08:31:25 -07:00
David Dalcino
1a918c35c5 Merge remote-tracking branch 'upstream/master' into specify-version-by-simplespec 2021-09-09 08:26:10 -07:00
Hiroshi Miura
320a20abb2 Merge pull request #385 from ddalcino/improve-error-handling
Improve error handling
2021-09-08 15:46:17 +09:00
David Dalcino
5a1aedb480 Add functions to determine extensions
This moves the logic for determining extensions out of the QtArchive
class so that it is available elsewhere and does not need to be
duplicated.
2021-09-07 14:27:51 -07:00
David Dalcino
88c30d90d0 Raise exceptions from existing exceptions 2021-09-02 09:57:34 -07:00
David Dalcino
a380f5c1ea Allow list-qt to describe Qt 6.2 wasm target
On August 19, the Qt repo added a new wasm release for Qt 6.2.0.
`list-qt` currently prints that the `wasm` extension is available for
that version of Qt, but it will not let the user use it to query
modules and architectures, because of a hardcoded version check.
This change rewrites the version check so that a user may make queries.
2021-09-01 13:38:09 -07:00
David Dalcino
f63fcc5c79 Add AqtException base exception class
This also moves the `format_suggested_follow_up` function into the new
AqtException class, refactors `show_list` to use the new exceptions,
and tests the new code appropriately.
2021-09-01 11:42:45 -07:00
David Dalcino
17dc333787 strip addons. prefix from list-qt --modules 2021-08-18 10:18:27 -07:00
Hiroshi Miura
c99ec5372b Coding style update by Black/isort
Change to max line length to 125

Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-08-02 13:50:00 +09:00
David Dalcino
1b6b3bcf86 Shorten SimpleSpec.usage string
If users need more complicated SimpleSpecs, they can read the docs linked above
2021-07-23 23:03:09 -07:00
David Dalcino
08a0ad0182 Add test, impl for optional 'tools_' prefix 2021-07-22 11:36:06 -07:00
David Dalcino
c37e09a8d5 Add type hints 2021-07-22 09:53:24 -07:00
David Dalcino
e9d1b52ac8 Remove unnecessary version mismatch checker 2021-07-22 09:53:24 -07:00
David Dalcino
f02e12eb8f fix MetadataFactory list-tool function 2021-07-22 09:53:23 -07:00
David Dalcino
a52214144c fix ArchiveId.to_url bug related to category 2021-07-22 09:53:23 -07:00
David Dalcino
8aa7af2524 Add new syntax to installer.Cli 2021-07-22 09:53:22 -07:00
David Dalcino
767b8d4bf2 Fix output strings 2021-07-22 09:53:22 -07:00
David Dalcino
d5f1c9487c Replace MetadataFactory.filter_minor with spec 2021-07-22 09:53:07 -07:00
David Dalcino
75007fa60f isort again 2021-07-18 19:34:42 -07:00
David Dalcino
e49c64bdcf remove unused imports 2021-07-18 19:28:46 -07:00
David Dalcino
2707ea108a Shift logging responsibility to caller
This allows the tests to run successfully, without interference from
the logger.
2021-07-18 19:23:33 -07:00
David Dalcino
bf196bb0ba Replace Callable with log_level
This allows the caller to pass a log level to the suggestions printer,
rather than a Callable.
2021-07-18 18:40:32 -07:00
David Dalcino
7b6af69645 Merge remote-tracking branch 'upstream/master' into refactor-show_suggestions
# Conflicts:
#	aqt/metadata.py
2021-07-18 02:19:48 -07:00
David Dalcino
0739629070 Refactor show_suggestion out of show_list & test 2021-07-18 02:16:37 -07:00
David Dalcino
55b858afc3 Refactor suggested_follow_up
This alters `suggested_follow_up` to return a list of strings.
This makes testing easier, as well as making it easier to change the
way the suggestions are displayed.

This change also fixes an error in the suggestions ('list' was missing
from the suggested command), and fixes some punctuation errors.

This also adds a print formatter that displays the suggestions nicely
in the terminal.
2021-07-18 01:39:25 -07:00
David Dalcino
72ef17c7b1 Rename aqt.list logger to aqt.metadata
This follows the convention set out by the rest of the project, where
the loggers are all named after the files in which they are used.
2021-07-18 01:34:28 -07:00
David Dalcino
4b82a08012 Add Versions.flattened(): return full list
`Versions.flattened()` returns a flat list of all the versions in the
Versions object, without any stratification by minor version.

This commit also updates the type hint for Versions.__iter__, which
returns a Generator.
2021-07-16 15:17:03 -07:00
Hiroshi Miura
da29dbfbc1 Handle notty case
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-07-15 17:53:24 +09:00
Hiroshi Miura
cf7aefd10c Change short listing of long tool option
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-07-15 13:23:56 +09:00
Hiroshi Miura
61c5625f3a Width adaptive list of tools
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-07-15 12:25:10 +09:00
Hiroshi Miura
15267182fa Refactoring class structure: Factory class, Data and consumer (#309)
* Introduce tooldata class

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

* Refactoring list command

- Introduce show_list function that is part of UI
- ListCommand class can be used as library to retrieve metadata.
- Rename ListCommand to MetadataFactory
- Rename action method to getList

Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-07-15 11:48:39 +09:00
David Dalcino
30f643d5e5 Add code to validate extensions
This change adds a function that checks for obvious misuses of the
`--extension` flag, according to these rules:

1. On Qt6 for Android, an extension for processor architecture is
required.
2. On any platform other than Android, or on Qt5, an extension for
processor architecture is forbidden.
3. The "wasm" extension only works on desktop targets for Qt 5.13-5.15.

This validation function is only called on requests for 'modules' and
'architectures', because these are the only places where the version
of Qt is known and the extension matters. Hopefully, this change will
reduce confusion among users.
2021-07-13 23:51:24 -07:00
David Dalcino
d02aada8b4 Fix failure of requests for Qt 5.9.0 (#312)
* Fix failure of requests for Qt 5.9.0

Currently, the following two commands fail with an HTTP 404 when they shouldn't:

```bash
aqt list qt5 windows desktop --modules 5.9.0
aqt list qt5 windows desktop --arch 5.9.0
```

This happens because ListCommand is looking for an xml file at `<base>/<host>/<target>/qt5_590/Updates.xml`; that file doesn't exist because it's actually at `<base>/<host>/<target>/qt5_59/Updates.xml`. So far, this is the only exception like this.

This change accounts for this exception.

* fix whitespace
2021-07-14 14:53:32 +09:00
Hiroshi Miura
a5bb6b7e96 Introduce metadata package (#305)
* Introduce metadata module

that has Versions and ListCommand class

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

* Introduce custom Version class

A Version class override semantic_version.Version class
that accept qt versions and tools versions

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

* PEP8/Black

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

* Improve test assertion

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

* Move ArchiveId class to metadata module

And Improve imports

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

* Refactoring Version class

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

* Refactoring Table class

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

* Refactoring Table class(wip)

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

* Fix output format of `list tools` command

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

* list: Improve print output

avoid str.join()

Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-07-13 00:10:36 +09:00