Commit 8d8822ed by finswimmer Committed by GitHub

Merge pull request #2375 from PetterS/simplity_printing

Simplify printing package operations
parents abee30f0 a60dcf0b
...@@ -255,30 +255,19 @@ class Installer: ...@@ -255,30 +255,19 @@ class Installer:
self._io.write_line("No dependencies to install or update") self._io.write_line("No dependencies to install or update")
if actual_ops and (self._execute_operations or self._dry_run): if actual_ops and (self._execute_operations or self._dry_run):
installs = [] installs = 0
updates = [] updates = 0
uninstalls = [] uninstalls = 0
skipped = [] skipped = 0
for op in ops: for op in ops:
if op.skipped: if op.skipped:
skipped.append(op) skipped += 1
continue elif op.job_type == "install":
installs += 1
if op.job_type == "install":
installs.append(
"{}:{}".format(
op.package.pretty_name, op.package.full_pretty_version
)
)
elif op.job_type == "update": elif op.job_type == "update":
updates.append( updates += 1
"{}:{}".format(
op.target_package.pretty_name,
op.target_package.full_pretty_version,
)
)
elif op.job_type == "uninstall": elif op.job_type == "uninstall":
uninstalls.append(op.package.pretty_name) uninstalls += 1
self._io.write_line("") self._io.write_line("")
self._io.write_line( self._io.write_line(
...@@ -287,13 +276,13 @@ class Installer: ...@@ -287,13 +276,13 @@ class Installer:
"<info>{}</> update{}, " "<info>{}</> update{}, "
"<info>{}</> removal{}" "<info>{}</> removal{}"
"{}".format( "{}".format(
len(installs), installs,
"" if len(installs) == 1 else "s", "" if installs == 1 else "s",
len(updates), updates,
"" if len(updates) == 1 else "s", "" if updates == 1 else "s",
len(uninstalls), uninstalls,
"" if len(uninstalls) == 1 else "s", "" if uninstalls == 1 else "s",
", <info>{}</> skipped".format(len(skipped)) ", <info>{}</> skipped".format(skipped)
if skipped and self.is_verbose() if skipped and self.is_verbose()
else "", else "",
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment