summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xportato.py9
-rw-r--r--portato/TEST_helper.py4
-rw-r--r--portato/__init__.py4
-rw-r--r--portato/backend/__init__.py20
-rw-r--r--portato/backend/flags.py29
-rw-r--r--portato/backend/package.py7
-rw-r--r--portato/backend/portage/__init__.py6
-rw-r--r--portato/backend/portage/package.py10
-rw-r--r--portato/backend/portage/settings.py2
-rw-r--r--portato/backend/portage/system.py18
-rw-r--r--portato/config_parser.py8
-rw-r--r--portato/gui/gtk/__init__.py16
-rw-r--r--portato/gui/gtk/basic.py4
-rw-r--r--portato/gui/gtk/exception_handling.py11
-rw-r--r--portato/gui/gtk/splash.py7
-rw-r--r--portato/gui/gtk/usetips.py8
-rw-r--r--portato/gui/gtk/windows.py31
-rw-r--r--portato/gui/gtk/wrapper.py4
-rw-r--r--portato/gui/gui_helper.py30
-rw-r--r--portato/helper.py1
-rw-r--r--portato/plistener.py8
-rw-r--r--portato/plugin.py57
-rw-r--r--portato/waiting_queue.py2
23 files changed, 172 insertions, 124 deletions
diff --git a/portato.py b/portato.py
index 1c73f74..da1ed88 100755
--- a/portato.py
+++ b/portato.py
@@ -12,11 +12,14 @@
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
-from portato import listener
-from portato.constants import VERSION, FRONTENDS, STD_FRONTEND, XSD_LOCATION, LOCALE_DIR, APP, SU_COMMAND
-from optparse import OptionParser
+from __future__ import with_statement, absolute_import
+
import sys, os
import gettext, locale
+from optparse import OptionParser
+
+from portato import listener
+from portato.constants import VERSION, FRONTENDS, STD_FRONTEND, XSD_LOCATION, LOCALE_DIR, APP, SU_COMMAND
def get_frontend_list ():
return ", ".join(["'%s'" % x for x in FRONTENDS])
diff --git a/portato/TEST_helper.py b/portato/TEST_helper.py
index cce0b61..88c4cd3 100644
--- a/portato/TEST_helper.py
+++ b/portato/TEST_helper.py
@@ -1,7 +1,9 @@
#!/usr/bin/python
+from __future__ import absolute_import
+
import unittest
-import helper
+import .helper
class HelperTest (unittest.TestCase):
diff --git a/portato/__init__.py b/portato/__init__.py
index 57dd691..76c6198 100644
--- a/portato/__init__.py
+++ b/portato/__init__.py
@@ -10,6 +10,8 @@
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
+from __future__ import absolute_import
+
import logging
import sys
import os
@@ -56,5 +58,5 @@ logging.getLogger("portatoLogger").addHandler(handler)
logging.getLogger("portatoLogger").setLevel(logging.DEBUG)
logging.getLogger("portatoLogger").propagate = False
-from plistener import PListener
+from .plistener import PListener
listener = PListener()
diff --git a/portato/backend/__init__.py b/portato/backend/__init__.py
index d1d61e8..92b77a8 100644
--- a/portato/backend/__init__.py
+++ b/portato/backend/__init__.py
@@ -10,12 +10,21 @@
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
-from exceptions import *
-from system_interface import SystemInterface
+from __future__ import absolute_import
+
+from .system_interface import SystemInterface
+from .exceptions import BlockedException, PackageNotFoundException, DependencyCalcError, InvalidSystemError
SYSTEM = "portage" # the name of the current system
_sys = None # the SystemInterface-instance
+class _Package (object):
+ """Wrapping class from which L{portato.backend.Package} inherits. This is used by the flags module to check
+ whether an object is a package. It cannot use the normal Package class as this results in cyclic dependencies."""
+
+ def __init__ (self):
+ raise TypeError, "Calling __init__ on portato.backend._Package objects is not allowed."
+
class SystemWrapper (SystemInterface):
"""This is a wrapper to the different system interfaces, allowing the direct import via C{from portato.backend import system}.
With this wrapper a change of the system is propagated to all imports."""
@@ -42,7 +51,7 @@ def load_system ():
global _sys
if SYSTEM == "portage":
- from portato.backend.portage import PortageSystem
+ from .portage import PortageSystem
_sys = PortageSystem ()
else:
raise InvalidSystemError, SYSTEM
@@ -50,6 +59,9 @@ def load_system ():
system = SystemWrapper()
# import package before loading the system as some systems may depend on it being in the namespace
-from package import Package
+from .package import Package
+
+def is_package(what):
+ return isinstance(what, Package)
load_system()
diff --git a/portato/backend/flags.py b/portato/backend/flags.py
index 99ff56f..1e1325e 100644
--- a/portato/backend/flags.py
+++ b/portato/backend/flags.py
@@ -10,14 +10,15 @@
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
+from __future__ import absolute_import
+
import os
import os.path
from subprocess import Popen, PIPE # needed for grep
from gettext import lgettext as _
-from portato.helper import *
-from portato.backend import system
-import package
+from . import system, _Package
+from ..helper import debug, error, unique_array
CONFIG = {
"usefile" : "portato",
@@ -93,7 +94,7 @@ def grep (pkg, path):
@returns: occurences of pkg in the format: "file:line-no:complete_line_found"
@rtype: string"""
- if not isinstance(pkg, package.Package):
+ if not isinstance(pkg, _Package):
pkg = system.new_package(pkg) # assume it is a cpv or a gentoolkit.Package
if os.path.exists(path):
@@ -201,7 +202,7 @@ def set_use_flag (pkg, flag):
global useFlags, newUseFlags
- if not isinstance(pkg, package.Package):
+ if not isinstance(pkg, _Package):
pkg = system.new_package(pkg) # assume cpv or gentoolkit.Package
cpv = pkg.get_cpv()
@@ -265,7 +266,7 @@ def remove_new_use_flags (cpv):
@param cpv: the package for which to remove the flags
@type cpv: string (cpv) or L{backend.Package}-object"""
- if isinstance(cpv, package.Package):
+ if isinstance(cpv, _Package):
cpv = cpv.get_cpv()
try:
@@ -281,7 +282,7 @@ def get_new_use_flags (cpv):
@returns: list of flags
@rtype: string[]"""
- if isinstance(cpv, package.Package):
+ if isinstance(cpv, _Package):
cpv = cpv.get_cpv()
list2return = []
@@ -398,7 +399,7 @@ def set_masked (pkg, masked = True):
global new_masked, newunmasked
- if not isinstance(pkg, package.Package):
+ if not isinstance(pkg, _Package):
pkg = system.new_package(pkg)
cpv = pkg.get_cpv()
@@ -457,7 +458,7 @@ def set_masked (pkg, masked = True):
debug("new_(un)masked: %s",str(link_neq))
def remove_new_masked (cpv):
- if isinstance(cpv, package.Package):
+ if isinstance(cpv, _Package):
cpv = cpv.get_cpv()
try:
@@ -471,7 +472,7 @@ def remove_new_masked (cpv):
pass
def new_masking_status (cpv):
- if isinstance(cpv, package.Package):
+ if isinstance(cpv, _Package):
cpv = cpv.get_cpv()
def get(list):
@@ -499,7 +500,7 @@ def new_masking_status (cpv):
def is_locally_masked (pkg, changes = True):
- if not isinstance(pkg, package.Package):
+ if not isinstance(pkg, _Package):
pkg = system.new_package(pkg) # assume it is a cpv or a gentoolkit.Package
if changes:
@@ -594,7 +595,7 @@ newTesting = {}
arch = ""
def remove_new_testing (cpv):
- if isinstance(cpv, package.Package):
+ if isinstance(cpv, _Package):
cpv = cpv.get_cpv()
try:
@@ -603,7 +604,7 @@ def remove_new_testing (cpv):
pass
def new_testing_status (cpv):
- if isinstance(cpv, package.Package):
+ if isinstance(cpv, _Package):
cpv = cpv.get_cpv()
if cpv in newTesting:
@@ -621,7 +622,7 @@ def set_testing (pkg, enable):
@type enable: boolean"""
global arch, newTesting
- if not isinstance(pkg, package.Package):
+ if not isinstance(pkg, _Package):
pkg = system.new_package(pkg)
arch = pkg.get_global_settings("ARCH")
diff --git a/portato/backend/package.py b/portato/backend/package.py
index 343dc51..a7f41d7 100644
--- a/portato/backend/package.py
+++ b/portato/backend/package.py
@@ -10,10 +10,11 @@
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
-from portato.backend import system
-import flags
+from __future__ import absolute_import
-class Package (object):
+from . import _Package, system, flags
+
+class Package (_Package):
"""This is a class abstracting a normal package which can be installed."""
def __init__ (self, cpv):
diff --git a/portato/backend/portage/__init__.py b/portato/backend/portage/__init__.py
index e21278c..6ccbf7f 100644
--- a/portato/backend/portage/__init__.py
+++ b/portato/backend/portage/__init__.py
@@ -10,5 +10,7 @@
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
-from system import PortageSystem
-from package import PortagePackage
+from __future__ import absolute_import
+
+from .system import PortageSystem
+from .package import PortagePackage
diff --git a/portato/backend/portage/package.py b/portato/backend/portage/package.py
index 2a2d81a..eea0ec8 100644
--- a/portato/backend/portage/package.py
+++ b/portato/backend/portage/package.py
@@ -10,9 +10,13 @@
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
-from portato.helper import *
-from portato.backend.exceptions import *
-from portato.backend import flags, Package, system
+from __future__ import absolute_import
+
+from ..package import Package
+from .. import flags
+from .. import system
+from ..exceptions import BlockedException, PackageNotFoundException
+from ...helper import debug, unique_array
import portage, portage_dep
from portage_util import unique_array
diff --git a/portato/backend/portage/settings.py b/portato/backend/portage/settings.py
index 5d3aef0..4e7a347 100644
--- a/portato/backend/portage/settings.py
+++ b/portato/backend/portage/settings.py
@@ -10,6 +10,8 @@
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
+from __future__ import absolute_import
+
import os
import portage
from threading import Lock
diff --git a/portato/backend/portage/system.py b/portato/backend/portage/system.py
index f6b2a3b..eeccb9c 100644
--- a/portato/backend/portage/system.py
+++ b/portato/backend/portage/system.py
@@ -10,15 +10,17 @@
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
+from __future__ import absolute_import
+
import re, os
import types
from gettext import lgettext as _
import portage
-import package
-from settings import PortageSettings
-from portato.helper import *
-from portato.backend.system_interface import SystemInterface
+from .package import PortagePackage
+from .settings import PortageSettings
+from ..system_interface import SystemInterface
+from ...helper import debug, unique_array
class PortageSystem (SystemInterface):
"""This class provides access to the portage-system."""
@@ -32,7 +34,7 @@ class PortageSystem (SystemInterface):
portage.WORLD_FILE = self.settings.settings["ROOT"]+portage.WORLD_FILE
def new_package (self, cpv):
- return package.PortagePackage(cpv)
+ return PortagePackage(cpv)
def get_config_path (self):
return portage.USER_CONFIG_PATH
@@ -115,13 +117,13 @@ class PortageSystem (SystemInterface):
@returns: converted list
@rtype: PortagePackage[]"""
- return [package.PortagePackage(x) for x in list_of_packages]
+ return [PortagePackage(x) for x in list_of_packages]
def get_global_settings (self, key):
return self.settings.settings[key]
def find_best (self, list):
- return package.PortagePackage(portage.best(list))
+ return PortagePackage(portage.best(list))
def find_best_match (self, search_key, only_installed = False):
t = None
@@ -263,7 +265,7 @@ class PortageSystem (SystemInterface):
return portage.catpkgsplit(cpv)
def sort_package_list(self, pkglist):
- pkglist.sort(package.PortagePackage.compare_version)
+ pkglist.sort(PortagePackage.compare_version)
return pkglist
def reload_settings (self):
diff --git a/portato/config_parser.py b/portato/config_parser.py
index 8555fc0..c3f5bae 100644
--- a/portato/config_parser.py
+++ b/portato/config_parser.py
@@ -29,12 +29,12 @@ Currently supported are the values (case insensitive): false, 0, off, falsch, ne
@var SECTION: Regular expression allowing the recognition of a section header.
@var EXPRESSION: Regular expression defining a normal option-value pair.
"""
+from __future__ import absolute_import
-from helper import debug
+import re
from gettext import lgettext as _
-import re
-import types
+from .helper import debug
DELIMITER = ["=", ":"]
COMMENT = [";","#"]
@@ -285,7 +285,7 @@ class ConfigParser:
section = section.upper()
key = key.lower()
- if not isinstance(value, types.BooleanType):
+ if not isinstance(value, bool):
raise ValueError, "Passed value must be a boolean."
val = self.vars[section][key]
diff --git a/portato/gui/gtk/__init__.py b/portato/gui/gtk/__init__.py
index ba49652..5a02c00 100644
--- a/portato/gui/gtk/__init__.py
+++ b/portato/gui/gtk/__init__.py
@@ -10,18 +10,20 @@
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
+from __future__ import absolute_import
+
from gettext import lgettext as _
-from portato import listener
-from exception_handling import register_ex_handler
+from ... import listener
+from .exception_handling import register_ex_handler
def run ():
- from splash import SplashScreen
+ from .splash import SplashScreen
try:
s = SplashScreen(_("Loading Portage"))
register_ex_handler()
s.show()
- from windows import MainWindow
+ from .windows import MainWindow
m = MainWindow(s)
s.hide()
m.main()
@@ -32,9 +34,9 @@ def run ():
def show_ebuild (pkg):
import gtk
- from portato import plugin
- from portato.backend import system
- from windows import SearchWindow, EbuildWindow
+ from ... import plugin
+ from ...backend import system
+ from .windows import SearchWindow, EbuildWindow
plugin.load_plugins("gtk")
register_ex_handler()
diff --git a/portato/gui/gtk/basic.py b/portato/gui/gtk/basic.py
index 882e40a..bc96c97 100644
--- a/portato/gui/gtk/basic.py
+++ b/portato/gui/gtk/basic.py
@@ -10,12 +10,14 @@
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
+from __future__ import absolute_import
+
# gtk stuff
import gtk
import gtk.glade
import gobject
-from portato.constants import DATA_DIR, APP_ICON, APP, LOCALE_DIR
+from ...constants import DATA_DIR, APP_ICON, APP, LOCALE_DIR
gtk.glade.bindtextdomain (APP, LOCALE_DIR)
gtk.glade.textdomain (APP)
diff --git a/portato/gui/gtk/exception_handling.py b/portato/gui/gtk/exception_handling.py
index e9d19d1..3d89560 100644
--- a/portato/gui/gtk/exception_handling.py
+++ b/portato/gui/gtk/exception_handling.py
@@ -11,6 +11,8 @@
#
# Written by René 'Necoro' Neumann
+from __future__ import absolute_import
+
import gtk, pango, gobject
import sys, traceback
@@ -18,7 +20,7 @@ from threading import Thread
from gettext import lgettext as _
from StringIO import StringIO
-from portato.helper import error
+from ...helper import error
class GtkThread (Thread):
def run(self):
@@ -29,10 +31,9 @@ class GtkThread (Thread):
except:
type, val, tb = sys.exc_info()
try:
- try:
- sys.excepthook(type, val, tb, thread = self.getName())
- except TypeError:
- raise type, val, tb # let normal thread handle it
+ sys.excepthook(type, val, tb, thread = self.getName())
+ except TypeError:
+ raise type, val, tb # let normal thread handle it
finally:
del type, val, tb
diff --git a/portato/gui/gtk/splash.py b/portato/gui/gtk/splash.py
index aa4a3ea..0b9a97f 100644
--- a/portato/gui/gtk/splash.py
+++ b/portato/gui/gtk/splash.py
@@ -9,12 +9,15 @@
# There is NO WARRANTY, to the extent permitted by law.
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
+
+from __future__ import absolute_import
+
import gtk
import gobject
from gettext import lgettext as _
-from portato.constants import VERSION, APP_ICON
-from basic import Window
+from ...constants import VERSION, APP_ICON
+from .basic import Window
class SplashScreen (Window):
diff --git a/portato/gui/gtk/usetips.py b/portato/gui/gtk/usetips.py
index 2c51d88..69e9f9a 100644
--- a/portato/gui/gtk/usetips.py
+++ b/portato/gui/gtk/usetips.py
@@ -10,10 +10,12 @@
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
-from portato.backend import system
-from portato.backend.flags import invert_use_flag
+from __future__ import absolute_import
-from TreeViewTooltips import TreeViewTooltips
+from ...backend import system
+from ...backend.flags import invert_use_flag
+
+from .TreeViewTooltips import TreeViewTooltips
class UseTips (TreeViewTooltips):
"""This class handles the display of the so called use-tips,
diff --git a/portato/gui/gtk/windows.py b/portato/gui/gtk/windows.py
index d227e45..562624c 100644
--- a/portato/gui/gtk/windows.py
+++ b/portato/gui/gtk/windows.py
@@ -10,6 +10,8 @@
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
+from __future__ import absolute_import
+
# gtk stuff
import gtk
import gobject
@@ -20,22 +22,21 @@ from subprocess import Popen
from gettext import lgettext as _
# our backend stuff
-from portato import listener
-from portato.helper import *
-from portato.constants import CONFIG_LOCATION, VERSION, APP_ICON
-from portato.backend import flags, system
-from portato.backend.exceptions import *
-
-# plugins
-from portato import plugin
+from ... import listener, plugin
+from ...helper import debug, warning, error, unique_array
+from ...constants import CONFIG_LOCATION, VERSION, APP_ICON
+from ...backend import flags, system
+from ...backend.exceptions import PackageNotFoundException, BlockedException
# more GUI stuff
-from portato.gui.gui_helper import Database, Config, EmergeQueue
-from basic import Window, AbstractDialog, Popup
-from dialogs import *
-from wrapper import GtkTree, GtkConsole
-from usetips import UseTips
-from exception_handling import GtkThread
+from ..gui_helper import Database, Config, EmergeQueue
+from .basic import Window, AbstractDialog, Popup
+from .wrapper import GtkTree, GtkConsole
+from .usetips import UseTips
+from .exception_handling import GtkThread
+from .dialogs import (blocked_dialog, changed_flags_dialog, io_ex_dialog,
+ nothing_found_dialog, queue_not_empty_dialog, remove_deps_dialog,
+ remove_queue_dialog, unmask_dialog)
class AboutWindow (AbstractDialog):
"""A window showing the "about"-informations."""
@@ -901,7 +902,7 @@ class MainWindow (Window):
self.cfg.modify_external_configs()
gtk.link_button_set_uri_hook(lambda btn, x: listener.send_cmd([self.cfg.get("browserCmd", section = "GUI"), btn.get_uri()]))
- gtk.about_dialog_set_url_hook(lambda *args: True) # dummy - if not set link is not set as link; if link is clicked the normal uri_hook is called too - thus do not call browser here
+ gtk.about_dialog_set_url_hook(lambda *args: True) # dummy - if not set link is not set as link; if link is clicked the normal uuri_hook is called too - thus do not call browser here
# set plugins and plugin-menu
splash(_("Loading Plugins"))
diff --git a/portato/gui/gtk/wrapper.py b/portato/gui/gtk/wrapper.py
index 7e67eb1..a322514 100644
--- a/portato/gui/gtk/wrapper.py
+++ b/portato/gui/gtk/wrapper.py
@@ -10,8 +10,10 @@
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
+from __future__ import absolute_import
+
from gettext import lgettext as _
-from portato.gui.wrapper import Tree, Console
+from ..wrapper import Tree, Console
import vte
class GtkTree (Tree):
diff --git a/portato/gui/gui_helper.py b/portato/gui/gui_helper.py
index 3ed8152..0d7ecf8 100644
--- a/portato/gui/gui_helper.py
+++ b/portato/gui/gui_helper.py
@@ -10,27 +10,25 @@
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
+from __future__ import absolute_import
+
+# some stuff needed
+import logging
+import os, pty
+import signal, threading, time
+from subprocess import Popen, PIPE, STDOUT
+
# some backend things
-from portato import backend
-from portato.backend import flags, system, set_system
-from portato.helper import debug, info, send_signal_to_group, set_log_level, unique_array
-from portato.waiting_queue import WaitingQueue
-from portato import plugin
+from .. import backend, plugin
+from ..backend import flags, system, set_system
+from ..helper import debug, info, send_signal_to_group, set_log_level, unique_array
+from ..waiting_queue import WaitingQueue
# parser
-from portato.config_parser import ConfigParser
+from ..config_parser import ConfigParser
# the wrapper
-from wrapper import Console, Tree
-
-# some stuff needed
-from subprocess import Popen, PIPE, STDOUT
-import threading
-import pty
-import time
-import os
-import signal
-import logging
+from .wrapper import Console, Tree
class Config:
"""Wrapper around a ConfigParser and for additional local configurations."""
diff --git a/portato/helper.py b/portato/helper.py
index cb3289c..b26b04c 100644
--- a/portato/helper.py
+++ b/portato/helper.py
@@ -13,6 +13,7 @@
"""
Some nice functions used in the program.
"""
+from __future__ import absolute_import
import os, signal, logging, grp
diff --git a/portato/plistener.py b/portato/plistener.py
index 1cd7529..452bee6 100644
--- a/portato/plistener.py
+++ b/portato/plistener.py
@@ -10,6 +10,8 @@
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
+from __future__ import absolute_import
+
import socket, os
from subprocess import Popen
from gettext import lgettext as _
@@ -19,8 +21,8 @@ try:
except ImportError:
pynotify = None
-from constants import SOCKET, APP
-from helper import debug, warning
+from .constants import SOCKET, APP
+from .helper import debug, warning
class PListener (object):
"""This class handles the communication between the "listener" and the GUI.
@@ -77,7 +79,7 @@ class PListener (object):
"""Displays a notify.
This will do nothing if pynotify is not present and/or root is running the listener."""
- if pynotify and not os.getuid == 0:
+ if pynotify and os.getuid() != 0:
if not pynotify.is_initted():
pynotify.init(APP)
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()
diff --git a/portato/waiting_queue.py b/portato/waiting_queue.py
index 409843c..32839d3 100644
--- a/portato/waiting_queue.py
+++ b/portato/waiting_queue.py
@@ -10,6 +10,8 @@
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
+from __future__ import absolute_import
+
from threading import Thread, Event
from Queue import Queue