X-Git-Url: https://git.camperquake.de/gitweb.cgi?p=time-slider.git;a=blobdiff_plain;f=usr%2Fshare%2Ftime-slider%2Flib%2Fplugin%2Fplugin.py;h=d20d3d2f9432f8a49a6031bf91010c4de0b74ece;hp=1b820ffe185b6ac57434a5b2977ab3e63453d03c;hb=f5fc3bcdc5e88e15cdb81d2644188a7eb5cebf3b;hpb=d021224696e8524cab857c27370e33aeaf024130 diff --git a/usr/share/time-slider/lib/plugin/plugin.py b/usr/share/time-slider/lib/plugin/plugin.py index 1b820ff..d20d3d2 100644 --- a/usr/share/time-slider/lib/plugin/plugin.py +++ b/usr/share/time-slider/lib/plugin/plugin.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2.6 +#!/usr/bin/python3 # # CDDL HEADER START # @@ -23,7 +23,7 @@ import os import sys import subprocess -import pluginsmf +from . import pluginsmf from time_slider import smf, autosnapsmf, util @@ -46,15 +46,15 @@ class Plugin(Exception): command = self.smfInst.get_trigger_command() try: statinfo = os.stat(command) - other_x = (statinfo.st_mode & 01) + other_x = (statinfo.st_mode & 0o1) if other_x == 0: - raise RuntimeError, 'Plugin: %s:\nConfigured trigger command is not ' \ + raise RuntimeError('Plugin: %s:\nConfigured trigger command is not ' \ 'executable:\n%s' \ - % (self.smfInst.instanceName, command) + % (self.smfInst.instanceName, command)) except OSError: - raise RuntimeError, 'Plugin: %s:\nCan not access the configured ' \ + raise RuntimeError('Plugin: %s:\nCan not access the configured ' \ 'plugin/trigger_command:\n%s' \ - % (self.smfInst.instanceName, command) + % (self.smfInst.instanceName, command)) def execute(self, schedule, label): @@ -96,9 +96,9 @@ class Plugin(Exception): stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True) - except OSError, message: - raise RuntimeError, "%s subprocess error:\n %s" % \ - (cmd, str(message)) + except OSError as message: + raise RuntimeError("%s subprocess error:\n %s" % \ + (cmd, str(message))) self._proc = None def is_running(self): @@ -142,8 +142,8 @@ class PluginManager(): err = p.wait() if err != 0: self._refreshLock.release() - raise RuntimeError, '%s failed with exit code %d\n%s' % \ - (str(cmd), err, errdata) + raise RuntimeError('%s failed with exit code %d\n%s' % \ + (str(cmd), err, errdata)) for line in outdata.rstrip().split('\n'): line = line.rstrip().split() state = line[0] @@ -158,7 +158,7 @@ class PluginManager(): try: plugin = Plugin(fmri, self.verbose) self.plugins.append(plugin) - except RuntimeError, message: + except RuntimeError as message: sys.stderr.write("Ignoring misconfigured plugin: %s\n" \ % (fmri)) sys.stderr.write("Reason:\n%s\n" % (message))