Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ Changelog
1.7.1 (unreleased)
------------------

- Nothing changed yet.
- Do not break in analyzing phase when vcur is None.
[thet]

- Fix output of report for humans to actually show data in the terminal.
[thet]

- Format output for humans as table.
[thet]


1.7.0 (2019-03-08)
Expand Down
2 changes: 1 addition & 1 deletion src/plone/versioncheck/analyser.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def is_cfgidx_newer(pkginfo, target_idx):
continue
if idx == 0:
vcur = parse_version(version)
if idx == target_idx:
if idx == target_idx and vcur:
return parse_version(version) > vcur
return False

Expand Down
13 changes: 9 additions & 4 deletions src/plone/versioncheck/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,14 @@ def human(
limit=limit,
)
termx, termy = get_terminal_size()
items = data.items()
max_name_length = max([len(name) for name, record in items])

for name, record in data.items():
print(color_by_state(record["state"]) + name)
sys.stderr.write(color_by_state(record["state"]) + name)
sys.stderr.write(" " * (max_name_length - len(name)))
for version in record["versions"]:
print(
sys.stderr.write(
" " * 4
+ color_by_state(version["state"])
+ version["version"]
Expand All @@ -227,7 +231,7 @@ def human(
)
if version.get("annotation", None):
indent = (pkgsinfo["ver_maxlen"] + 5) * " " + "a "
print(
sys.stderr.write(
color_dimmed()
+ textwrap.fill(
version["annotation"],
Expand All @@ -240,7 +244,7 @@ def human(
if show_requiredby and record.get("required_by", False):
req = " ".join(sorted(record.get("required_by")))
indent = (pkgsinfo["ver_maxlen"] + 5) * " " + "r "
print(
sys.stderr.write(
color_dimmed()
+ textwrap.fill(
req,
Expand All @@ -249,6 +253,7 @@ def human(
subsequent_indent=indent,
)
)
sys.stderr.write("\n")


def json_serial(obj):
Expand Down