diff options
author | Dmitrii Agibov <dmitrii.agibov@arm.com> | 2022-09-02 09:24:58 +0100 |
---|---|---|
committer | Diego Russo <diego.russo@arm.com> | 2022-09-02 15:51:15 +0000 |
commit | cde0c6ee140bd108849bff40467d8f18ffc332ef (patch) | |
tree | 9bd805147cae3385b91ccfa055b7c3e017db8323 | |
parent | 6c7908b25faab2eb66b936ea99bb6cf3f1d237aa (diff) | |
download | mlia-cde0c6ee140bd108849bff40467d8f18ffc332ef.tar.gz |
MLIA-602 Fix output formatting issue
Apply the same formatting rules for each section in the
output of the command "backend status"
Change-Id: I253c513f99826ef1eb916285ca4c2cc1840633ac
-rw-r--r-- | src/mlia/tools/metadata/common.py | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/mlia/tools/metadata/common.py b/src/mlia/tools/metadata/common.py index c17a738..924e870 100644 --- a/src/mlia/tools/metadata/common.py +++ b/src/mlia/tools/metadata/common.py @@ -255,20 +255,28 @@ class DefaultInstallationManager(InstallationManager, InstallationFiltersMixin): def show_env_details(self) -> None: """Print current state of the execution environment.""" if installed := self.already_installed(): - logger.info("Installed backends:\n") - - for installation in installed: - logger.info(" - %s", installation.name) + self._print_installation_list("Installed backends:", installed) if could_be_installed := self.ready_for_installation(): - logger.info("Following backends could be installed:") - - for installation in could_be_installed: - logger.info(" - %s", installation.name) + self._print_installation_list( + "Following backends could be installed:", + could_be_installed, + new_section=bool(installed), + ) if not installed and not could_be_installed: logger.info("No backends installed") + @staticmethod + def _print_installation_list( + header: str, installations: List[Installation], new_section: bool = False + ) -> None: + """Print list of the installations.""" + logger.info("%s%s\n", "\n" if new_section else "", header) + + for installation in installations: + logger.info(" - %s", installation.name) + def _install( self, installation: Installation, |