diff options
author | Papoteur <papoteur@mageia.org> | 2020-11-27 09:03:08 +0100 |
---|---|---|
committer | Papoteur <papoteur@mageia.org> | 2020-11-27 09:06:29 +0100 |
commit | 17a807839cf1290f0a5c7a8ac5990850c5d8e2d3 (patch) | |
tree | b3a399f533379de2f716b724f3133d5aa0bd184f /lib | |
parent | 9dd22baebdf1d8e01707bb23491ad7d6da54f1d5 (diff) | |
download | isodumper-17a807839cf1290f0a5c7a8ac5990850c5d8e2d3.tar isodumper-17a807839cf1290f0a5c7a8ac5990850c5d8e2d3.tar.gz isodumper-17a807839cf1290f0a5c7a8ac5990850c5d8e2d3.tar.bz2 isodumper-17a807839cf1290f0a5c7a8ac5990850c5d8e2d3.tar.xz isodumper-17a807839cf1290f0a5c7a8ac5990850c5d8e2d3.zip |
Add debug option, --debug and write in .isodumper/isodumper2.log
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/isodumper.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/isodumper.py b/lib/isodumper.py index 51e85ff..e43fda5 100755 --- a/lib/isodumper.py +++ b/lib/isodumper.py @@ -28,6 +28,7 @@ # ensure we're using the latest build, if called from our build environment import sys import importlib +import logging try: from isodumper import version @@ -118,7 +119,6 @@ class UDisks2(object): if objects[block['path']][self.SERVICE + '.Partition']['Table'].split('/')[-1] == target: if (self.SERVICE + '.Encrypted' in objects[block['path']]): # Is the partition encrypted ? path_to_encrypted = objects[block['path']][self.SERVICE + '.Encrypted']['CleartextDevice'] - print(path_to_encrypted) if path_to_encrypted != '/': iface = self.bus.get(self.SERVICE, path_to_encrypted) fs = iface[self.SERVICE + '.Filesystem'] @@ -127,12 +127,16 @@ class UDisks2(object): iface = self.bus.get(self.SERVICE, block['path']) fs = iface[self.SERVICE + '.Encrypted'] fs.Lock({}) + logging.debug(f"Unmounting encryted {block['path']}") else: iface = self.bus.get(self.SERVICE, block['path']) if self.SERVICE + '.Filesystem' in objects[block['path']]: fs = iface[self.SERVICE + '.Filesystem'] if fs.MountPoints: # partition is mounted + logging.debug(f"Unmounting {block['path']}") fs.Unmount({}) + else: + logging.debug(f"Not mounted {block['path']}") return True, "" def eject(self, device): @@ -555,7 +559,7 @@ exFAT, NTFS or ext. You can specify a volume name and the format in a new dialog if self.ask_OK(info): return - def __init__(self): + def __init__(self, debug=False): APP = "isodumper" DIR = "/usr/share/locale" # Call translation catalog @@ -572,6 +576,10 @@ exFAT, NTFS or ext. You can specify a volume name and the format in a new dialog exit() # TODO Read log level from command line + level = logging.DEBUG if debug else logging.ERROR + logging.basicConfig(filename=os.path.join(os.path.expanduser('~'), '.isodumper',"isodumper2.log"), + format='%(asctime)s %(levelname)-8s %(message)s', + level=level) # define size of the selected device self.deviceSize = 0 @@ -857,10 +865,14 @@ if __name__ == "__main__": # Send the yui logging outside of the console log = yui.YUILog.setLogFileName("/dev/null") parser = ParseCLI('isodumper') + parser.parser.add_argument('--debug', help=_('allow debug information'), action='store_true') if parser.args.version: print(version.RELEASE) else: - app = IsoDumper() + if parser.args.debug: + app = IsoDumper(debug=True) + else: + app = 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 |