Commit Graph

816 Commits

Author SHA1 Message Date
Hiroshi Miura
0c346d77c8 Merge branch 'master' into topic-tool-latest 2021-07-15 14:10:09 +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
Hiroshi Miura
0d7c3eecb8 Merge pull request #316 from miurahr/patch-refactoring-installer
Refactoring call_instaler/installer
2021-07-15 09:49:10 +09:00
Hiroshi Miura
62d8ed3b55 Rename to get_packages
- It is problematic name that QtArchive.get_archives returns List[QtPackage]

Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-07-15 09:32:26 +09:00
Hiroshi Miura
6aeac16335 Merge pull request #315 from miurahr/patch-drop-unused
Drop unused class
2021-07-15 09:10:11 +09:00
Hiroshi Miura
bc8f309e36 Merge pull request #317 from miurahr/topic-add-coverage
Add coverage test
2021-07-15 09:09:50 +09:00
Hiroshi Miura
d56c5caae2 Add coveralls badge
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-07-15 09:04:56 +09:00
Hiroshi Miura
f7a8bc80eb Add coverage test
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-07-15 09:00:19 +09:00
Hiroshi Miura
f1b8b5a2c3 Refactoring call_instaler/installer
- Introduce `run_installer` that consume `List[QtArchives]` data
  to be same structure as `show_list` and `ToolData` data class.

Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-07-15 08:33:50 +09:00
Hiroshi Miura
1721a21390 Drop unused class
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-07-15 08:32:04 +09:00
Hiroshi Miura
ab823596dc Utilize dataclasses (#313)
* Utilize dataclasses

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

* PEP8

Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-07-15 08:08:53 +09:00
Hiroshi Miura
1368956730 Merge pull request #314 from ddalcino/extension-validation
Extension validation in ListCommand
2021-07-15 08:08:32 +09:00
David Dalcino
248df89ef2 Update test_list.py 2021-07-14 12:07:39 -07:00
David Dalcino
89ffd60e61 Improve name and formatting of expected error msg 2021-07-13 23:59:41 -07: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
766ae8bc7f Fix update path for winrt (#311)
* Fix update path for winrt

Fixed #310


Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-07-13 23:52:12 +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
Hiroshi Miura
9e44b7eed6 Update ci and document
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-07-11 11:30:40 +09:00
Hiroshi Miura
fff94542cf PEP8/Black
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-07-11 11:17:53 +09:00
Hiroshi Miura
1846e2edcf Install all listed tools
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-07-11 11:07:11 +09:00
Hiroshi Miura
534bfc6add Make ListCommand iterable
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-07-11 11:06:48 +09:00
Hiroshi Miura
9cb3e880ae wip: fix error
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-07-11 10:42:27 +09:00
Hiroshi Miura
3d9ef1ac6b Update dummy version handling
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-07-11 10:29:29 +09:00
Hiroshi Miura
ade43e2247 Merge pull request #304 from ddalcino/list-tool-versions
List tool versions
2021-07-11 10:21:22 +09:00
David Dalcino
aa7d44bce7 black 2021-07-09 19:05:28 -07:00
David Dalcino
10d4ec02d5 Add tool-long-listing to ListCommand
This change adds the ability to list all the 'tool variant names'
alongside the version and release date of the tool.

When using the `aqt list tools` feature, I often find that I need more
information than the tool provides. I often need to know the release
date and the version for each tool, and I can't get that information
without looking up the Updates.xml file. This feature enables me to skip
that part.
2021-07-09 19:05:08 -07:00
Hiroshi Miura
358687d7e5 Merge branch 'master' into topic-tool-latest 2021-07-10 09:29:22 +09:00
David Dalcino
7a2e7faf53 Allow ListCommand to choose tool by version
This adds the function `ListCommand.fetch_tool_by_simple_spec`. This
allows the caller to specify a SimpleSpec and the name of a tool, and
the function will return the Updates.xml record for the specified tool
with the largest version number that satisfies the SimpleSpec. This is
meant to allow users to install tools without specifying an explicit
version number.

This also adds some test code to validate the complicated parts of this
code.

This also extends `helper.xml_to_modules`, so that a caller can
automatically get all tags in an XML element without explicitly
specifying them.
2021-07-09 17:02:50 -07:00
Hiroshi Miura
e8b849fa58 Drop duplicated members 2021-07-10 01:02:35 +09:00
Hiroshi Miura
905d9c2f5f wip
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-07-10 00:59:01 +09:00
Hiroshi Miura
62c7075aeb Accept target argument 2021-07-09 23:53:41 +09:00
Hiroshi Miura
234261ffbb Merge pull request #302 from ddalcino/patch-1
Fix `ToolArchives.__str__()`
2021-07-08 13:28:07 +09:00
David Dalcino
eb9908d4a8 Fix ToolArchives.__str__()
This change prevents an AttributeError from being raised when `ToolArchive.__str__()` is called.

Neither `ToolArchives` nor the parent class `QtArchives` contains the data member `version_str`, yet it is referenced in the `__str__` method. This change replaces it with the correct data member, `QtArchives.version`.
2021-07-07 17:51:45 -07:00
Hiroshi Miura
61913c2128 Merge pull request #301 from ddalcino/consistent-version-validation
Validate version strings more consistently
2021-07-07 07:36:43 +09:00
David Dalcino
860d297b2d Validate version strings more consistently 2021-07-06 12:16:58 -07:00
Hiroshi Miura
f007ad8e7b Quick hack to install latest version of tool
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-07-06 18:15:21 +09:00
Hiroshi Miura
a969c2403d Merge pull request #298 from miurahr/patch-workflow-conditions-release
GHA: fix release condition
v2.0.0b2
2021-07-06 13:49:13 +09:00
Hiroshi Miura
852a20f16e GHA: fix release condition
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-07-06 13:45:53 +09:00
Hiroshi Miura
47f312e9e8 Tool subcommand show aqt version in log
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
v2.0.0b1
2021-07-06 13:22:01 +09:00
Hiroshi Miura
ee1c3c4a42 Update changelog to catch recent progress
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-07-06 13:15:37 +09:00
Julien Marrec
91f33da898 Minor changes: use posixpath.join, add __repr__/__str__, some type hints, and some mypy issues (#287)
* Avoid calling functions with positional args: use names in case you reorder, Some type hints + __repr__ and __str__

* Use posixpath.join

* mypy issue: logger is sometimes passed.

* mypy: rename the Settings class to SettingsClass

```
aqt/helper.py:333: error: Cannot assign to a type
aqt/helper.py:333: error: Incompatible types in assignment (expression has type "Settings", variable has type "Type[Settings]")
```

* Reduce indenting by avoiding unnecessary except.else

* more calling by named arguments
2021-07-06 12:13:35 +09:00
Hiroshi Miura
a14f6a6d8b helper: make max_retries configurable (#296)
* helper: make max_retries configurable

Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-07-06 08:44:00 +09:00
Hiroshi Miura
6a4d660cc9 gha: fix release note script
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-07-06 08:42:38 +09:00
David Dalcino
705c6225e2 Add capability to list tools (#235)
* Add html scraping capability to helper.py

The function scrape_html_for_folders() reads an html file at
`https://download.qt.io/online/qtsdkrepository/<os>/<target>/` and
extracts a list of all the folders within that directory.
It separates the folders by category, so that 'tools' are not
mixed in with 'qt5' or 'qt6'.

This commit also adds a function that prints the available folders,
allowing the caller to filter the output by category.

* Add interface for accessing scrape_html_for_folders

I'm sure this isn't exactly what is needed, and that this functionality
should probably be folded into `aqt list`, but it does demonstrate that
aqt can list all the tools available at downloads.qt.io by scraping html.

This allows you to type `aqt list2 tools linux desktop`, and get a list
of all the tools on the server.
There are more options; type `aqt list2 -h` to see them all.

* Add failing tests for `aqt list`

* Add passing implementation of `aqt list`

* Remove old implementation of `aqt list`

This removes `Cli.run_list_old`, as well as any commented-out code in
installer.py that was related to the old implementation of `run_list`.

This also restores some code that was commented out erroneously.

* Fix misuse of semantic_version

In an earlier commit, I used the parameter `partial=True` for the
preview builds of Qt, since they do not include a patch number. I did
not recognize this as a misuse of semantic_version until I ran the tox
linter. `partial` is meant for 'partial specification', as in, 'this
program requires version 6.2, and the patch is unimportant`.

This change removes the `partial=True` parameter, adds a `0` for the
patch number, and uses a format string to print preview versions without
the patch.

* Use semantic version in interfaces instead of str

This updates all functions that accept a Qt version as a string, so that
they now accept a semantic version object instead. This forces the
caller to do some input validation, and moves the responsibility of
string-to-version conversions out of functions where it does not belong.

* Improve `aqt list` interface as discussed

This adds several new options to `aqt list`, and renames the ambiguous
`packages` to `modules`. New options include the ability to list
targets, extensions, and architectures for a particular (host, target,
Qt version) tuple. The goal is to provide sufficient information to the
user, such that the user can use all the other features of aqt without
having to look them up somewhere else.

* Cleanup `targets` dictionary

* Add `list architectures` feature

* Add tests for `list architectures` feature

* Add documentation for new list feature.

* Fix url bugs related to BASE_URL change

* Add stub for `list --extensions`

* Implement `list --extensions`

* Cleanup imports

* Add basic tests of `aqt list` to azure pipeline

* Fix failed merge with upstream

* Simplify string-to-version code

An earlier commit introduced `cli_2_semantic_version`, which calls
`get_semantic_version_with_dots`, which will never be called by any
other code. I think that this should really just be one function, and
splitting it in two is just needlessly complex.

* Revert dd41e653 - changes to azure-pipelines.yml

* CI: change test case for list command

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

* Update MANIFEST

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

* Fix errors reported by flake8

This commit fixes some unused imports, missing imports, and formatting
errors.

* Run isort

* Add three more build jobs to azure pipelines

This adds three more combinations of `qt version/host/target` to the
`aqt list` command tests on the azure pipelines. This is pretty far from
exhaustive, but I think it's worth it to add these: they execute
slightly different code paths than the standard `linux/desktop`
variants. I don't want to add a whole lot more than this; `aqt list` is
slower than I'd like it to be, and I don't want to waste CI time.

* Fix bug where empty extensions returns success

Prior to this commit, if you ran `aqt list` to list possible extensions,
it could print a blank line and return 0. This is because the
get_extensions_for_version function was accepting empty strings as a
valid extension, and returning a list consisting of one empty string.
This commit filters out those empty strings.

* Attempt to fix ci bug when listing android exts

Android extensions for Qt6 follow different rules than Qt5; this
attempts to account for that.

* remove invalid ArchiveId objects from tests

* Add author

* Use Python for test logic instead of bash

* Remove 'build accelbubble' step from 'list' test

This commit attempts to separate the 'build accelbubble example' test
from the 'aqt list' test.

In this case, the test for `aqt list qt5 linux android` was running the
"build accelbubble example" test in addition to the intended test. If
the "build accelbubble example" test fails, then it looks like the `aqt
list` test failed, until you look to see why it failed.

* Remove dead code

* Accept `latest` keyword instead of qt version

This commit modifies the interface of `aqt list`, so that the flags
`--modules`, `--extensions`, and `--arch` will accept either a Qt
version or the word `latest`. If the user specifies a version of Qt,
the command works as before. If the user specifies `--modules latest`,
`aqt list` will determine the latest version of Qt, given the filters
specified, and return the modules for that version.

This commit removes the flag `--latest-modules`, because that flag is no
longer necessary. The `latest` keyword serves the same function, and it
works for the `--extensions`, and `--arch` flags as well. This prevents
the need for flags such as `--latest-extensions` and `--latest-arch`,
which otherwise would have been necessary to provide this functionality
to the other list features.

* remove unused import

* Update azure pipeline to reflect `latest` feature

* WIP refactor helper methods into ListCommand

* Refactor helper methods into ListCommand

This PR adds many helper methods to helper.py that are closely related
to each other, and which are only useful to the ListCommand object. This
commit moves the majority of these into the ListCommand object, so that
they don't confuse future readers who are looking for something else.

* Fix imports after merge

* Fix unused import

* Add test and impl for list tool modules

This adds code that parses an 'Updates.xml' file for the names of tool
modules, which a user can use to install tools. This does not have any
cli-facing code yet, since the current interface does not make sense for
this purpose.

* Add CLI command to list tool variant names

This exposes `ListCommand.fetch_tool_modules` to the CLI.
Accordingly, it adds a test to the Azure Pipelines for every `aqt list`
job, and it adds documentation to docs/cli.rst.

Since this feature is meant to print values you can feed into the `aqt
tool` command, the documentation for the `aqt tool` command was changed
as well.

* Use monkeypatch for http_fetcher

This removes the http_fetcher parameter for ListCommand in favor of
monkeypatching.

* Remove dataclasses

Dataclasses were new in Python 3.7, and don't exist in the minimum
supported Python 3.6.

* black

* Fix ci test for `aqt list tools --tool`

* Add default timeout to request_http_with_failover

* fix monkeypatched http fetcher

* Fix 'aqt list tools' command on Azure Pipeline

Currently, the `tools_qt3dstudio_runtime_240` appears to be the only
tool available on all host/target combinations, so we will check that
one in Azure Pipelines.

* Move helper classes specific to ListCommand into ListCommand

* Fix use of new global Settings object

* Fix sphinx docstring syntax

* Swap `request_http_with_failover` for `getUrl`

* Add additional follow-up suggestion on error

* Fix exceptions import

* Prevent repeated 'suggested follow up' actions

This change uses exclusive branches to prevent `aqt list` from repeating
the same/similar recommended actions.

* Fix bugs related to updated getUrl error messages

* run black

* docs: add auto section link label extension

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

* docs: add more list command examples

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

* Fix typo in docs

* remove duplicate `semantic_version`

* Add expected outputs and arch example to docs

This change adds some expected output to the documentation. For any
user who is confused about what the documentation means when it
mentions `tools` and `modules`, and is unsure which is which, this
change should help that user figure that out.

This also adds an example for listing architectures.

* Remove `logger` from `getUrl` parameter list

* helper: getLogger("aqt.helper") in helper functions

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

* Use `pretty_print` instead of `str()` for output

* test_list.py use pretty_print instead of str

* fix Versions constructor

* black

Co-authored-by: Hiroshi Miura <miurahr@linux.com>
2021-07-06 07:58:18 +09:00
Hiroshi Miura
4c16bc6fd0 Merge pull request #297 from miurahr/patch-change-loading-settingsinit-loglevel
Change log level to debug for settings.ini loading
2021-07-05 13:29:33 +09:00
Hiroshi Miura
265c0c5b4b Change log level to debug for settings.ini loading
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-07-05 13:04:04 +09:00
Hiroshi Miura
a4d30994b3 Merge pull request #295 from miurahr/patch-ci-jom-download
bundle jom.zip  for test
2021-07-05 12:31:15 +09:00
Hiroshi Miura
d7acd2bee5 bundle jom.zip for test
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-07-05 09:10:28 +09:00
Hiroshi Miura
8781bcc3b9 Merge pull request #293 from ddalcino/patch-1
Fix test_connection.py (again ... oops)
2021-07-02 11:59:37 +09:00