This also updates the type hints for the PackageUpdate class, to make
it easier to understand the datatypes. It also adds some assertions
to prove what types they are.
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.
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.
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.
This adds an accessor function, `QtArchives._base_package_names`,
that returns a list of all possible PackageUpdate.Name properties
for the base package
This also renames `QtArchives._base_target_package_name` to
`_base_module_name`, so that its meaning is more clear in context
and not so easy to confuse with the new function.
This change allows for the future implementation of a `--noarchives`
flag for the `install-src/doc/example` commands.
I don't know if end users will need this or not, but I need this to
determine whether or not archive filtration works properly.
This property is tested in `tests/test_archive.py` at
`test_archives_weird_module_7z_name()`.
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.
This is a code-readability improvement. Every time I read this code,
I get tripped up by the `if not all_archives:` line, and I have to hunt
for all uses of `all_archives` to see what it means and what it does.
This change moves the assignment next to its usage, so its meaning and
scope are immediately clear, and no hunting is necessary. This also
gives it a less ambiguous name.
This change will likely make the reader wonder if this variable is
needed at all; the conditional `if subarchives is not None:` would
probably work just as well. I would tend to agree.
However, I am leaving this variable in because the variable name
documents what the code is doing and why.
I recognize that the value of this change is very subjective, and I am
happy to revert this if necessary.
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.
The interface for ToolArchives says that `version_str` is optional,
but when you try to use it with the default value, the QtArchives
constructor raises a ValueError exception. This change substitutes
the dummy value used by the Cli.run_install_tool for version_str, when
version_str is empty.
This adds the "Name" property from the "PackageUpdate" element from
"Updates.xml" to the QtPackage objects. This is intended to make
testing easier: if the "Name" property is missing, there's no way to
find out which PackageUpdate the 7z archive came from after it has
been added to the QtArchive.
In the case of ToolArchive contents, the `QtPackage.pkg_update_name`
is redundant, because the "Name" property is already saved as
`QtPackage.name`. The `QtPackage.name` property is being used in two
different ways in two different places, probably because of different
naming conventions.
- 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>
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.
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.