From bd588eb9a4b2890da6f9db928f302e2e98a7b9ce Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Tue, 10 May 2022 16:47:47 +0200 Subject: add missing english translations and verify message texts of raised exceptions in tests --- src/hydrilla/builder/local_apt.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/hydrilla/builder/local_apt.py') diff --git a/src/hydrilla/builder/local_apt.py b/src/hydrilla/builder/local_apt.py index 8382af8..4c93a4d 100644 --- a/src/hydrilla/builder/local_apt.py +++ b/src/hydrilla/builder/local_apt.py @@ -114,10 +114,11 @@ class Apt: try: cp = run(command, **kwargs) except FileNotFoundError: - raise AptError(_('couldnt_execute_apt_get_is_it_installed')) + msg = _('couldnt_execute_{}_is_it_installed').format('apt-get') + raise AptError(msg) if cp.returncode != 0: - msg = _('apt_get_command_{}_failed').format(' '.join(command)) + msg = _('command_{}_failed').format(' '.join(command)) raise AptError(msg, cp) return cp @@ -185,7 +186,7 @@ def apt_keyring(keys: [str]) -> bytes: try: from gnupg import GPG except ModuleNotFoundError: - raise GpgError(_('couldnt_import_gnupg_is_it_installed')) + raise GpgError(_('couldnt_import_{}_is_it_installed').format('gnupg')) gpg = GPG(keyring=str(cache_dir() / 'master_keyring.gpg')) for key in keys: @@ -193,7 +194,7 @@ def apt_keyring(keys: [str]) -> bytes: continue if gpg.recv_keys(default_keyserver, key).imported == 0: - raise GpgError(_('gpg_couldnt_recv_key')) + raise GpgError(_('gpg_couldnt_recv_key_{}').format(key)) return gpg.export_keys(keys, armor=False, minimal=True) @@ -404,10 +405,11 @@ def piggybacked_system(piggyback_def: dict, foreign_packages: Optional[Path]) \ try: cp = run(command) except FileNotFoundError: - raise AptError(_('couldnt_execute_dpkg_deb_is_it_installed')) + msg = _('couldnt_execute_{}_is_it_installed'.format('dpkg-deb')) + raise AptError(msg) if cp.returncode != 0: - msg = _('dpkg_deb_command_{}_failed').format(' '.join(command)) + msg = _('command_{}_failed').format(' '.join(command)) raise AptError(msg, cp) docs_dir = root / 'usr' / 'share' / 'doc' -- cgit v1.2.3