This is rework of #214, where was major issue with logging translated messages to anaconda.log file.
In this rework, this issue is fixed as well as code was cleaned from previous junk made in attempting to add package logging support.
This rework is attempt to improve package logging, where untranslated string is logged and translated string is returned back to GUI for user.
Signed-off-by: Karel Valek kvalek@redhat.com
From: Karel Valek kvalek@redhat.com
This is rework of #214, where was major issue with logging translated messages to anaconda.log file.
In this rework, this issue is fixed as well as code was cleaned from previous junk made in attempting to add package logging support.
This rework is attempt to improve package logging, where untranslated string is logged and translated string is returned back to GUI for user.
Signed-off-by: Karel Valek kvalek@redhat.com --- pyanaconda/install.py | 28 ++++++++++++++-------------- pyanaconda/packaging/dnfpayload.py | 14 +++++++------- pyanaconda/progress.py | 4 +++- 3 files changed, 24 insertions(+), 22 deletions(-)
diff --git a/pyanaconda/install.py b/pyanaconda/install.py index 43655c9..802939b 100644 --- a/pyanaconda/install.py +++ b/pyanaconda/install.py @@ -30,7 +30,7 @@ from pyanaconda import iutil from pyanaconda import timezone from pyanaconda import network -from pyanaconda.i18n import _ +from pyanaconda.i18n import _, N_ from pyanaconda.threads import threadMgr from pyanaconda.ui.lib.entropy import wait_for_entropy from pyanaconda.kickstart import runPostScripts, runPreInstallScripts @@ -72,7 +72,7 @@ def doConfiguration(storage, payload, ksdata, instClass):
# Now run the execute methods of ksdata that require an installed system # to be present first. - with progress_report(_("Configuring installed system")): + with progress_report(N_("Configuring installed system")): ksdata.authconfig.execute(storage, ksdata, instClass) ksdata.selinux.execute(storage, ksdata, instClass) ksdata.firstboot.execute(storage, ksdata, instClass) @@ -85,11 +85,11 @@ def doConfiguration(storage, payload, ksdata, instClass): ksdata.skipx.execute(storage, ksdata, instClass)
if willWriteNetwork: - with progress_report(_("Writing network configuration")): + with progress_report(N_("Writing network configuration")): ksdata.network.execute(storage, ksdata, instClass)
# Creating users and groups requires some pre-configuration. - with progress_report(_("Creating users")): + with progress_report(N_("Creating users")): createLuserConf(iutil.getSysroot(), algoname=getPassAlgo(ksdata.authconfig.authconfig)) u = Users() ksdata.rootpw.execute(storage, ksdata, instClass, u) @@ -97,10 +97,10 @@ def doConfiguration(storage, payload, ksdata, instClass): ksdata.user.execute(storage, ksdata, instClass, u) ksdata.sshkey.execute(storage, ksdata, instClass, u)
- with progress_report(_("Configuring addons")): + with progress_report(N_("Configuring addons")): ksdata.addons.execute(storage, ksdata, instClass, u)
- with progress_report(_("Generating initramfs")): + with progress_report(N_("Generating initramfs")): payload.recreateInitrds()
# Work around rhbz#1200539, grubby doesn't handle grub2 missing initrd with /boot on btrfs @@ -111,10 +111,10 @@ def doConfiguration(storage, payload, ksdata, instClass): writeBootLoader(storage, payload, instClass, ksdata)
if willRunRealmd: - with progress_report(_("Joining realm: %s") % ksdata.realm.discovered): + with progress_report(N_("Joining realm: %s") % ksdata.realm.discovered): ksdata.realm.execute(storage, ksdata, instClass)
- with progress_report(_("Running post-installation scripts")): + with progress_report(N_("Running post-installation scripts")): runPostScripts(ksdata.scripts)
# setup kexec reboot if requested @@ -166,14 +166,14 @@ def doInstall(storage, payload, ksdata, instClass): if threadMgr.running > 1: progress_init(steps+1)
- with progress_report(_("Waiting for %s threads to finish") % (threadMgr.running-1)): + with progress_report(N_("Waiting for %s threads to finish") % (threadMgr.running-1)): for message in ("Thread %s is running" % n for n in threadMgr.names): log.debug(message) threadMgr.wait_all() else: progress_init(steps)
- with progress_report(_("Setting up the installation environment")): + with progress_report(N_("Setting up the installation environment")): ksdata.firstboot.setup(storage, ksdata, instClass) ksdata.addons.setup(storage, ksdata, instClass)
@@ -197,7 +197,7 @@ def doInstall(storage, payload, ksdata, instClass): payload.writeStorageEarly()
# Run %pre-install scripts with the filesystem mounted and no packages - with progress_report(_("Running pre-installation scripts")): + with progress_report(N_("Running pre-installation scripts")): runPreInstallScripts(ksdata.scripts)
# Do packaging. @@ -205,7 +205,7 @@ def doInstall(storage, payload, ksdata, instClass): # Discover information about realms to join, # to determine additional packages if willRunRealmd: - with progress_report(_("Discovering realm to join")): + with progress_report(N_("Discovering realm to join")): ksdata.realm.setup()
# Check for additional packages @@ -237,10 +237,10 @@ def doInstall(storage, payload, ksdata, instClass):
# Do bootloader. if willInstallBootloader: - with progress_report(_("Installing boot loader")): + with progress_report(N_("Installing boot loader")): writeBootLoader(storage, payload, instClass, ksdata)
- with progress_report(_("Performing post-installation setup tasks")): + with progress_report(N_("Performing post-installation setup tasks")): payload.postInstall()
progress_complete() diff --git a/pyanaconda/packaging/dnfpayload.py b/pyanaconda/packaging/dnfpayload.py index 608a636..9361f6c 100644 --- a/pyanaconda/packaging/dnfpayload.py +++ b/pyanaconda/packaging/dnfpayload.py @@ -24,8 +24,8 @@ from blivet.size import Size import blivet.arch from pyanaconda.flags import flags -from pyanaconda.i18n import _ -from pyanaconda.progress import progressQ +from pyanaconda.i18n import _, N_ +from pyanaconda.progress import progressQ, progress_message from pyanaconda.simpleconfig import simple_replace
import configparser @@ -631,7 +631,7 @@ def gatherRepoMetadata(self): self._refreshEnvironmentAddons()
def install(self): - progressQ.send_message(_('Starting package installation process')) + progress_message(N_('Starting package installation process'))
# Add the rpm macros to the global transaction environment for macro in self.rpmMacros: @@ -660,8 +660,8 @@ def install(self):
log.info('Downloading packages finished.')
- pre_msg = _("Preparing transaction from installation source") - progressQ.send_message(pre_msg) + pre_msg = (N_("Preparing transaction from installation source")) + progress_message(pre_msg)
queue_instance = multiprocessing.Queue() process = multiprocessing.Process(target=do_transaction, @@ -677,8 +677,8 @@ def install(self): if token == 'quit': _failure_limbo()
- post_msg = _("Performing post-installation setup tasks") - progressQ.send_message(post_msg) + post_msg = (N_("Performing post-installation setup tasks")) + progress_message(post_msg) process.join() self._base.close() if os.path.exists(self._download_location): diff --git a/pyanaconda/progress.py b/pyanaconda/progress.py index f1d20ad..bd0b4c7 100644 --- a/pyanaconda/progress.py +++ b/pyanaconda/progress.py @@ -18,6 +18,8 @@ # # Author(s): Chris Lumens clumens@redhat.com
+from pyanaconda.i18n import _, N_ + import logging log = logging.getLogger("anaconda")
@@ -50,7 +52,7 @@ def progress_report(message): progress_step(message)
def progress_message(message): - progressQ.send_message(message) + progressQ.send_message(_(message)) log.info(message)
def progress_step(message):
Other than the two issues reported by our tests (two unused imports) this looks good to me. Thanks for the rework!
Added label: ACK.
anaconda-patches@lists.fedorahosted.org