From 6851d7dfbf8f3adc914495649a4604b0850124eb Mon Sep 17 00:00:00 2001 From: Papoteur Date: Sat, 13 Jun 2020 08:18:14 +0200 Subject: Suppress YUI log from console (mga#26681) also with the launcher Move version in Makefile : use 'make version' to have it in lib/version.py --- Makefile | 8 ++++++-- isodumper | 23 ++++++++++++++++++----- lib/isodumper.py | 17 ++++++++--------- 3 files changed, 32 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 66a5061..c2c0101 100644 --- a/Makefile +++ b/Makefile @@ -33,10 +33,13 @@ DBUSDIR=$(SYSCONFDIR)/dbus-1 SYSTEMDCONFDIR=$(LIBDIR)/systemd/system/ PACKAGE = isodumper -VERSION = 1.17 +VERSION = 1.18 GITPATH = git://git.mageia.org/software/isodumper -all: dirs pofiles +all: version dirs pofiles + +version: + echo "RELEASE='$(VERSION)'" > lib/version.py dirs: @for n in . $(DIRS); do \ @@ -84,6 +87,7 @@ install: # for PYLIBFILES isodumper.py raw_write.py mkdir -p $(DESTDIR)$(PYLIBDIR)/isodumper install -m 755 lib/isodumper.py $(DESTDIR)$(PYLIBDIR)/isodumper + install -m 755 lib/version.py $(DESTDIR)$(PYLIBDIR)/isodumper install -m 755 backend/raw_write.py $(DESTDIR)$(PYLIBDIR)/isodumper # for LIBFILES raw_format.py diff --git a/isodumper b/isodumper index df1b890..e091e16 100755 --- a/isodumper +++ b/isodumper @@ -1,9 +1,22 @@ #!/usr/bin/python3 from isodumper import isodumper +import manatools.args as args +from isodumper import version import yui -app = isodumper.IsoDumper() -app.run() -# next line seems to be a workaround to prevent the qt-app from crashing -# see https://github.com/libyui/libyui-qt/issues/41 -yui.YUILoader.deleteUI() +class ParseCLI(args.AppArgs): + def __init(self, command): + super().__init__(command) + +# Suppress YUI log from console (mga#26681) +yui.YUILog.setLogFileName("/dev/null") + +parser = ParseCLI('isodumper') +if parser.args.version: + print(version.RELEASE) +else: + app = isodumper.IsoDumper() + app.run() + # next line seems to be a workaround to prevent the qt-app from crashing + # see https://github.com/libyui/libyui-qt/issues/41 + yui.YUILoader.deleteUI() diff --git a/lib/isodumper.py b/lib/isodumper.py index 984d037..b135a75 100755 --- a/lib/isodumper.py +++ b/lib/isodumper.py @@ -28,6 +28,10 @@ # ensure we're using the latest build, if called from our build environment import sys import importlib +try: + from isodumper import version +except: + import version sys.path.insert(0,'../../../build/swig/python3') importlib.reload(sys) @@ -37,10 +41,6 @@ importlib.reload(sys) import yui import time -#log = yui.YUILog.instance() -#log.setLogFileName("isodumper.log") -#log.enableDebugLogging( True ) - import os import re import gettext @@ -51,7 +51,6 @@ from gi.repository import GLib import psutil import manatools.args as args -RELEASE="v1.17" class NoUDisks2(Exception): @@ -506,7 +505,7 @@ exFAT, NTFS or ext. You can specify a volume name and the format in a new dialog """ Init/Constructor for the 'widgets' """ - yui.YUI.app().setApplicationTitle(_("IsoDumper") + " " + RELEASE) + yui.YUI.app().setApplicationTitle(_("IsoDumper") + " " + version.RELEASE) yui.YUI.app().setApplicationIcon("/usr/share/icons/isodumper.png") self.atelier = yui.YUI.widgetFactory() self.dialog = self.atelier.createPopupDialog() @@ -679,7 +678,7 @@ exFAT, NTFS or ext. You can specify a volume name and the format in a new dialog def aboutDialog(self): yui.YUI.widgetFactory; mgafactory = yui.YMGAWidgetFactory.getYMGAWidgetFactory(yui.YExternalWidgets.externalWidgetFactory("mga")) - dlg = mgafactory.createAboutDialog("Isodumper", self.RELEASE, "GPLv2", + dlg = mgafactory.createAboutDialog("Isodumper", version.RELEASE, "GPLv2", _("Oliver Grawert
Papoteur
Pictures : Timothée Giet"), _("A tool for writing ISO images to a device")+"
http://gitweb.mageia.org/software/isodumper", "") dlg.show(); @@ -772,10 +771,10 @@ exFAT, NTFS or ext. You can specify a volume name and the format in a new dialog if __name__ == "__main__": # Send the yui logging outside of the console - yui.YUILog.setLogFileName("/dev/null") + log = yui.YUILog.setLogFileName("/dev/null") parser = ParseCLI('isodumper') if parser.args.version: - print(RELEASE) + print(version.RELEASE) else: app = IsoDumper() app.run() -- cgit v1.2.1