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`_
|
`Unreleased`_
|
||||||
=============
|
=============
|
||||||
|
|
||||||
|
Added
|
||||||
|
-----
|
||||||
|
* Add error messages when user inputs an invalid semantic version(#291)
|
||||||
|
|
||||||
Changed
|
Changed
|
||||||
-------
|
-------
|
||||||
* list subcommand now support tool information(#235)
|
* list subcommand now support tool information(#235)
|
||||||
* list subcommand can show versions, archiectures and modules.(#235)
|
* list subcommand can show versions, archiectures and modules.(#235)
|
||||||
* Add max_retries configuration for connection(#296)
|
* 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.
|
* Change log format for logging file.
|
||||||
|
* Extension validation for tool subcommand(#314)
|
||||||
|
* list subcommand has --tool-long option(#304, #319)
|
||||||
|
|
||||||
Fixed
|
Fixed
|
||||||
-----
|
-----
|
||||||
* Fix helper.getUrl() to handle several response statuses(#292)
|
* Fix helper.getUrl() to handle several response statuses(#292)
|
||||||
* Fix Qt 6.2.0 target path for macOS.(#289)
|
* 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)
|
`v1.2.2`_ (1, Jul. 2021)
|
||||||
========================
|
========================
|
||||||
|
|||||||
@@ -21,5 +21,9 @@ recursive-include tests *.ini
|
|||||||
recursive-include tests *.json
|
recursive-include tests *.json
|
||||||
recursive-include tests *.py
|
recursive-include tests *.py
|
||||||
recursive-include tests *.xml
|
recursive-include tests *.xml
|
||||||
exclude .gitignore
|
|
||||||
prune .github
|
prune .github
|
||||||
|
exclude .gitignore
|
||||||
|
exclude azure-pipelines.yml
|
||||||
|
exclude qtaccount.ini
|
||||||
|
exclude aqtinstall.log
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import operator
|
|||||||
import posixpath
|
import posixpath
|
||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
|
import shutil
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
from typing import (
|
from typing import (
|
||||||
Callable,
|
Callable,
|
||||||
@@ -282,35 +283,59 @@ class ToolData:
|
|||||||
"Description",
|
"Description",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
short_head = [
|
||||||
|
"Tool Variant Name",
|
||||||
|
"Version",
|
||||||
|
"Release Date",
|
||||||
|
]
|
||||||
|
|
||||||
def __init__(self, tool_data):
|
def __init__(self, tool_data):
|
||||||
self.tool_data = 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:
|
def __format__(self, format_spec) -> str:
|
||||||
if format_spec == "{s}":
|
short = False
|
||||||
|
if format_spec == "{:s}":
|
||||||
return str(self)
|
return str(self)
|
||||||
if format_spec == "":
|
if format_spec == "":
|
||||||
max_width: int = 0
|
max_width: int = 0
|
||||||
|
elif format_spec == "{:T}":
|
||||||
|
short = True
|
||||||
|
max_width = 0
|
||||||
else:
|
else:
|
||||||
match = re.match(r"\{(.*):(\d*)t\}", format_spec)
|
match = re.match(r"\{?:?(\d+)t\}?", format_spec)
|
||||||
if match:
|
if match:
|
||||||
g = match.groups()
|
g = match.groups()
|
||||||
max_width = 0 if g[1] == "" else int(g[1])
|
max_width = int(g[0])
|
||||||
else:
|
else:
|
||||||
raise ValueError("Wrong format")
|
raise ValueError("Wrong format {}".format(format_spec))
|
||||||
table = Texttable(max_width=max_width)
|
table = Texttable(max_width=max_width)
|
||||||
table.set_deco(Texttable.HEADER)
|
table.set_deco(Texttable.HEADER)
|
||||||
table.header(self.head)
|
if short:
|
||||||
table.add_rows(self.rows, header=False)
|
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)
|
||||||
return table.draw()
|
return table.draw()
|
||||||
|
|
||||||
@property
|
def _rows(self):
|
||||||
def rows(self):
|
|
||||||
keys = ("Version", "ReleaseDate", "DisplayName", "Description")
|
keys = ("Version", "ReleaseDate", "DisplayName", "Description")
|
||||||
return [
|
return [
|
||||||
[name, *[content[key] for key in keys]]
|
[name, *[content[key] for key in keys]]
|
||||||
for name, content in self.tool_data.items()
|
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:
|
class MetadataFactory:
|
||||||
"""Retrieve metadata of Qt variations, versions, and descriptions from Qt site."""
|
"""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):
|
if isinstance(output, Versions):
|
||||||
print(format(output))
|
print(format(output))
|
||||||
elif isinstance(output, ToolData):
|
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():
|
elif meta.archive_id.is_tools():
|
||||||
print(*output, sep="\n")
|
print(*output, sep="\n")
|
||||||
else:
|
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)
|
monkeypatch.setattr(MetadataFactory, "fetch_http", lambda self, _: _xml)
|
||||||
|
|
||||||
table = MetadataFactory(archive_id).fetch_tool_long_listing(tool_name)
|
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(
|
@pytest.mark.parametrize(
|
||||||
|
|||||||
Reference in New Issue
Block a user