cli/install: Make package lists more readable and colorize messages
This commit is contained in:
@@ -45,8 +45,9 @@ def install_pkg_names(A, reinstall = False):
|
|||||||
Ap = set(filter(lambda x: not installdb.has_package(x), A))
|
Ap = set(filter(lambda x: not installdb.has_package(x), A))
|
||||||
d = A - Ap
|
d = A - Ap
|
||||||
if len(d) > 0:
|
if len(d) > 0:
|
||||||
ctx.ui.warning(_("The following package(s) are already installed and are not going to be installed again:\n") +
|
ctx.ui.warning(_("The following package(s) are already installed "
|
||||||
util.strlist(d))
|
"and are not going to be installed again:"))
|
||||||
|
ctx.ui.info(util.format_by_columns(sorted(d)))
|
||||||
A = Ap
|
A = Ap
|
||||||
|
|
||||||
if len(A)==0:
|
if len(A)==0:
|
||||||
@@ -68,8 +69,8 @@ def install_pkg_names(A, reinstall = False):
|
|||||||
order = operations.helper.reorder_base_packages(order)
|
order = operations.helper.reorder_base_packages(order)
|
||||||
|
|
||||||
if len(order) > 1:
|
if len(order) > 1:
|
||||||
ctx.ui.info(_("Following packages will be installed in the respective "
|
ctx.ui.info(util.colorize(_("Following packages will be installed:"), "brightblue"))
|
||||||
"order to satisfy dependencies:\n") + util.strlist(order))
|
ctx.ui.info(util.format_by_columns(sorted(order)))
|
||||||
|
|
||||||
total_size, cached_size = operations.helper.calculate_download_sizes(order)
|
total_size, cached_size = operations.helper.calculate_download_sizes(order)
|
||||||
total_size, symbol = util.human_readable_size(total_size)
|
total_size, symbol = util.human_readable_size(total_size)
|
||||||
@@ -131,8 +132,9 @@ def install_pkg_files(package_URIs, reinstall = False):
|
|||||||
else:
|
else:
|
||||||
tobe_installed.append(x)
|
tobe_installed.append(x)
|
||||||
if already_installed:
|
if already_installed:
|
||||||
ctx.ui.warning(_("The following package(s) are already installed and are not going to be installed again:\n") +
|
ctx.ui.warning(_("The following package(s) are already installed "
|
||||||
util.strlist(already_installed))
|
"and are not going to be installed again:"))
|
||||||
|
ctx.ui.info(util.format_by_columns(sorted(already_installed)))
|
||||||
package_URIs = tobe_installed
|
package_URIs = tobe_installed
|
||||||
|
|
||||||
if ctx.config.get_option('ignore_dependency'):
|
if ctx.config.get_option('ignore_dependency'):
|
||||||
@@ -193,9 +195,9 @@ def install_pkg_files(package_URIs, reinstall = False):
|
|||||||
# if so, then invoke install_pkg_names
|
# if so, then invoke install_pkg_names
|
||||||
extra_packages = [x.package for x in dep_unsatis]
|
extra_packages = [x.package for x in dep_unsatis]
|
||||||
if extra_packages:
|
if extra_packages:
|
||||||
ctx.ui.info(_("""The following packages will be installed
|
ctx.ui.warning(_("The following packages will be installed "
|
||||||
in the respective order to satisfy extra dependencies:
|
"in order to satisfy dependencies:"))
|
||||||
""") + util.strlist(extra_packages))
|
ctx.ui.info(util.format_by_columns(sorted(extra_packages)))
|
||||||
if not ctx.ui.confirm(_('Do you want to continue?')):
|
if not ctx.ui.confirm(_('Do you want to continue?')):
|
||||||
raise Exception(_('External dependencies not satisfied'))
|
raise Exception(_('External dependencies not satisfied'))
|
||||||
install_pkg_names(extra_packages, reinstall=True)
|
install_pkg_names(extra_packages, reinstall=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user