mirror of
https://github.com/miurahr/aqtinstall.git
synced 2025-12-18 13:14:37 +03:00
Merge branch 'master' into topic-tool-latest
This commit is contained in:
@@ -7,19 +7,26 @@ All notable changes to this project will be documented in this file.
|
||||
`Unreleased`_
|
||||
=============
|
||||
|
||||
Added
|
||||
-----
|
||||
* Add error messages when user inputs an invalid semantic version(#291)
|
||||
|
||||
Changed
|
||||
-------
|
||||
* list subcommand now support tool information(#235)
|
||||
* list subcommand can show versions, archiectures and modules.(#235)
|
||||
* Add max_retries configuration for connection(#296)
|
||||
* Change settings.ini to introduce [requests] section[#297]
|
||||
* Change settings.ini to introduce [requests] section(#297)
|
||||
* Change log format for logging file.
|
||||
* Extension validation for tool subcommand(#314)
|
||||
* list subcommand has --tool-long option(#304, #319)
|
||||
|
||||
Fixed
|
||||
-----
|
||||
* Fix helper.getUrl() to handle several response statuses(#292)
|
||||
* Fix Qt 6.2.0 target path for macOS.(#289)
|
||||
|
||||
* Fix WinRT installation patching(#311)
|
||||
* Fix Qt 5.9.0 installation (#312)
|
||||
|
||||
`v1.2.2`_ (1, Jul. 2021)
|
||||
========================
|
||||
|
||||
@@ -21,5 +21,9 @@ recursive-include tests *.ini
|
||||
recursive-include tests *.json
|
||||
recursive-include tests *.py
|
||||
recursive-include tests *.xml
|
||||
exclude .gitignore
|
||||
prune .github
|
||||
exclude .gitignore
|
||||
exclude azure-pipelines.yml
|
||||
exclude qtaccount.ini
|
||||
exclude aqtinstall.log
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import operator
|
||||
import posixpath
|
||||
import random
|
||||
import re
|
||||
import shutil
|
||||
from logging import getLogger
|
||||
from typing import (
|
||||
Callable,
|
||||
@@ -282,35 +283,59 @@ class ToolData:
|
||||
"Description",
|
||||
]
|
||||
|
||||
short_head = [
|
||||
"Tool Variant Name",
|
||||
"Version",
|
||||
"Release Date",
|
||||
]
|
||||
|
||||
def __init__(self, tool_data):
|
||||
self.tool_data = tool_data
|
||||
for key in tool_data.keys():
|
||||
self.tool_data[key]["Description"] = tool_data[key]["Description"].replace(
|
||||
"<br>", "\n"
|
||||
)
|
||||
|
||||
def __format__(self, format_spec) -> str:
|
||||
if format_spec == "{s}":
|
||||
short = False
|
||||
if format_spec == "{:s}":
|
||||
return str(self)
|
||||
if format_spec == "":
|
||||
max_width: int = 0
|
||||
elif format_spec == "{:T}":
|
||||
short = True
|
||||
max_width = 0
|
||||
else:
|
||||
match = re.match(r"\{(.*):(\d*)t\}", format_spec)
|
||||
match = re.match(r"\{?:?(\d+)t\}?", format_spec)
|
||||
if match:
|
||||
g = match.groups()
|
||||
max_width = 0 if g[1] == "" else int(g[1])
|
||||
max_width = int(g[0])
|
||||
else:
|
||||
raise ValueError("Wrong format")
|
||||
raise ValueError("Wrong format {}".format(format_spec))
|
||||
table = Texttable(max_width=max_width)
|
||||
table.set_deco(Texttable.HEADER)
|
||||
if short:
|
||||
table.header(self.short_head)
|
||||
table.add_rows(self._short_rows(), header=False)
|
||||
else:
|
||||
table.header(self.head)
|
||||
table.add_rows(self.rows, header=False)
|
||||
table.add_rows(self._rows(), header=False)
|
||||
return table.draw()
|
||||
|
||||
@property
|
||||
def rows(self):
|
||||
def _rows(self):
|
||||
keys = ("Version", "ReleaseDate", "DisplayName", "Description")
|
||||
return [
|
||||
[name, *[content[key] for key in keys]]
|
||||
for name, content in self.tool_data.items()
|
||||
]
|
||||
|
||||
def _short_rows(self):
|
||||
keys = ("Version", "ReleaseDate")
|
||||
return [
|
||||
[name, *[content[key] for key in keys]]
|
||||
for name, content in self.tool_data.items()
|
||||
]
|
||||
|
||||
|
||||
class MetadataFactory:
|
||||
"""Retrieve metadata of Qt variations, versions, and descriptions from Qt site."""
|
||||
@@ -699,7 +724,13 @@ def show_list(meta: MetadataFactory) -> int:
|
||||
if isinstance(output, Versions):
|
||||
print(format(output))
|
||||
elif isinstance(output, ToolData):
|
||||
print(format(output, "{:t}")) # can set width "{:100t}"
|
||||
width: int = shutil.get_terminal_size((0, 40)).columns
|
||||
if width == 0: # notty ?
|
||||
print(format(output, "{:0t}"))
|
||||
elif width < 95: # narrow terminal
|
||||
print(format(output, "{:T}"))
|
||||
else:
|
||||
print("{0:{1}t}".format(output, width))
|
||||
elif meta.archive_id.is_tools():
|
||||
print(*output, sep="\n")
|
||||
else:
|
||||
|
||||
@@ -148,7 +148,7 @@ def test_tool_long_listing(monkeypatch, host: str, target: str, tool_name: str):
|
||||
monkeypatch.setattr(MetadataFactory, "fetch_http", lambda self, _: _xml)
|
||||
|
||||
table = MetadataFactory(archive_id).fetch_tool_long_listing(tool_name)
|
||||
assert table.rows == expect["long_listing"]
|
||||
assert table._rows() == expect["long_listing"]
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
||||
Reference in New Issue
Block a user