summaryrefslogtreecommitdiff
path: root/portato/plugin.py
diff options
context:
space:
mode:
authornecoro <>2007-08-27 07:30:38 +0000
committernecoro <>2007-08-27 07:30:38 +0000
commit8c066e79b03ad4e20a9f7c4ae36a9e247b79a8eb (patch)
treecbc6522de7532adc6a85ff6e816e186b077f2cc4 /portato/plugin.py
parentc16b547f2c2bc23bef3a93b1987715c00c521718 (diff)
downloadportato-8c066e79b03ad4e20a9f7c4ae36a9e247b79a8eb.tar.gz
portato-8c066e79b03ad4e20a9f7c4ae36a9e247b79a8eb.tar.bz2
portato-8c066e79b03ad4e20a9f7c4ae36a9e247b79a8eb.zip
Change to absolute_imports; Warning: definitly broken
Diffstat (limited to '')
-rw-r--r--portato/plugin.py57
1 files changed, 29 insertions, 28 deletions
diff --git a/portato/plugin.py b/portato/plugin.py
index baa5d0c..09f2dea 100644
--- a/portato/plugin.py
+++ b/portato/plugin.py
@@ -12,13 +12,15 @@
"""A module containing the management of the plugin system."""
+from __future__ import absolute_import
+
import os, os.path
from xml.dom.minidom import parse
from lxml import etree
from gettext import lgettext as _
-from constants import PLUGIN_DIR, XSD_LOCATION
-from helper import *
+from .constants import PLUGIN_DIR, XSD_LOCATION
+from .helper import debug, info, error, flatten
class PluginImportException (ImportError):
pass
@@ -365,33 +367,32 @@ class PluginQueue:
doc = parse(p)
try:
- try:
- list = doc.getElementsByTagName("plugin")
- elem = list[0]
-
- frontendOK = None
- frontends = elem.getElementsByTagName("frontends")
- if frontends:
- nodes = frontends[0].childNodes
- for f in nodes[0].nodeValue.strip().split():
- if f == self.frontend:
- frontendOK = True # one positive is enough
- break
- elif frontendOK is None: # do not make negative if we already have a positive
- frontendOK = False
-
- if frontendOK is None or frontendOK == True:
- plugin = Plugin(p, elem.getElementsByTagName("name")[0], elem.getElementsByTagName("author")[0])
- plugin.parse_hooks(elem.getElementsByTagName("hooks")[0])
- plugin.set_import(elem.getElementsByTagName("import"))
- plugin.parse_menus(elem.getElementsByTagName("menu"))
- plugin.parse_options(elem.getElementsByTagName("options"))
-
- self.list.append(plugin)
- info(_("Plugin '%s' loaded."), p)
+ list = doc.getElementsByTagName("plugin")
+ elem = list[0]
+
+ frontendOK = None
+ frontends = elem.getElementsByTagName("frontends")
+ if frontends:
+ nodes = frontends[0].childNodes
+ for f in nodes[0].nodeValue.strip().split():
+ if f == self.frontend:
+ frontendOK = True # one positive is enough
+ break
+ elif frontendOK is None: # do not make negative if we already have a positive
+ frontendOK = False
+
+ if frontendOK is None or frontendOK == True:
+ plugin = Plugin(p, elem.getElementsByTagName("name")[0], elem.getElementsByTagName("author")[0])
+ plugin.parse_hooks(elem.getElementsByTagName("hooks")[0])
+ plugin.set_import(elem.getElementsByTagName("import"))
+ plugin.parse_menus(elem.getElementsByTagName("menu"))
+ plugin.parse_options(elem.getElementsByTagName("options"))
- except PluginImportException, e:
- error(_("Loading plugin '%(plugin)s' failed: Could not import %(import)s"), {"plugin": p, "import": e[0]})
+ self.list.append(plugin)
+ info(_("Plugin '%s' loaded."), p)
+
+ except PluginImportException, e:
+ error(_("Loading plugin '%(plugin)s' failed: Could not import %(import)s"), {"plugin": p, "import": e[0]})
finally:
doc.unlink()