From 0885d993b40c92d86a61e3952c9df6c00578bfce Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Tue, 24 Jun 2008 10:54:57 +0200 Subject: Removed frontend specification from notify plugin --- plugins/notify.xml | 1 - 1 file changed, 1 deletion(-) (limited to 'plugins') diff --git a/plugins/notify.xml b/plugins/notify.xml index 8de08c8..9a89987 100644 --- a/plugins/notify.xml +++ b/plugins/notify.xml @@ -3,7 +3,6 @@ René 'Necoro' Neumann Notify - gtk portato.plugins.notify -- cgit v1.2.3-54-g00ecf From dd83f2011ffee4d8eea7b78f86631c7266cdfdc2 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Thu, 3 Jul 2008 23:21:09 +0200 Subject: Ported Notify plugin --- plugins/notify.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ plugins/notify.xml | 14 -------------- portato/plugins/__init__.py | 7 ++++++- portato/plugins/notify.py | 22 ---------------------- 4 files changed, 51 insertions(+), 37 deletions(-) create mode 100644 plugins/notify.py delete mode 100644 plugins/notify.xml delete mode 100644 portato/plugins/notify.py (limited to 'plugins') diff --git a/plugins/notify.py b/plugins/notify.py new file mode 100644 index 0000000..bc1b2ea --- /dev/null +++ b/plugins/notify.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# +# File: plugins/notify.py +# This file is part of the Portato-Project, a graphical portage-frontend. +# +# Copyright (C) 2007-2008 René 'Necoro' Neumann +# This is free software. You may redistribute copies of it under the terms of +# the GNU General Public License version 2. +# There is NO WARRANTY, to the extent permitted by law. +# +# Written by René 'Necoro' Neumann + +import pynotify + +from portato import get_listener + +from portato.helper import warning, error, debug +from portato.constants import APP_ICON, APP + +class Notify (Plugin): + __author__ = "René 'Necoro' Neumann" + __description__ = "Show notifications when an emerge process finishes." + __dependency__ = ["dev-python/notify-python"] + + def __init__ (self): + Plugin.__init__(self) + self.add_call("after_emerge", self.notify) + + def notify (self, retcode, **kwargs): + if retcode is None: + warning("NOTIFY :: %s", _("Notify called while process is still running!")) + else: + icon = APP_ICON + if retcode == 0: + text = _("Emerge finished!") + descr = "" + urgency = pynotify.URGENCY_NORMAL + else: + text = _("Emerge failed!") + descr = _("Error Code: %d") % retcode + urgency = pynotify.URGENCY_CRITICAL + + get_listener().send_notify(base = text, descr = descr, icon = icon, urgency = urgency) + +register(Notify) diff --git a/plugins/notify.xml b/plugins/notify.xml deleted file mode 100644 index 8de08c8..0000000 --- a/plugins/notify.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - René 'Necoro' Neumann - Notify - gtk - - portato.plugins.notify - - - - - - diff --git a/portato/plugins/__init__.py b/portato/plugins/__init__.py index fe95dbc..5080cec 100644 --- a/portato/plugins/__init__.py +++ b/portato/plugins/__init__.py @@ -3,9 +3,14 @@ # File: portato/plugins/__init__.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2007 René 'Necoro' Neumann +# Copyright (C) 2007-2008 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. # # Written by René 'Necoro' Neumann + +""" +This is a dummy module. The plugins loaded from here are in reality stored +in /usr/share/portato/plugins or alike. +""" diff --git a/portato/plugins/notify.py b/portato/plugins/notify.py deleted file mode 100644 index 78812b3..0000000 --- a/portato/plugins/notify.py +++ /dev/null @@ -1,22 +0,0 @@ -import pynotify - -from portato import get_listener - -from portato.helper import warning, error, debug -from portato.constants import APP_ICON, APP - -def notify (retcode, **kwargs): - if retcode is None: - warning("NOTIFY :: %s", _("Notify called while process is still running!")) - else: - icon = APP_ICON - if retcode == 0: - text = _("Emerge finished!") - descr = "" - urgency = pynotify.URGENCY_NORMAL - else: - text = _("Emerge failed!") - descr = _("Error Code: %d") % retcode - urgency = pynotify.URGENCY_CRITICAL - - get_listener().send_notify(base = text, descr = descr, icon = icon, urgency = urgency) -- cgit v1.2.3-54-g00ecf From 1540e5c8fbba5713e0176c8812f7473ea5e91037 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Thu, 3 Jul 2008 23:25:24 +0200 Subject: Ported gpytage plugin --- plugins/gpytage.py | 27 +++++++++++++++++++++++++++ plugins/gpytage.xml | 13 ------------- portato/plugins/gpytage.py | 16 ---------------- 3 files changed, 27 insertions(+), 29 deletions(-) create mode 100644 plugins/gpytage.py delete mode 100644 plugins/gpytage.xml delete mode 100644 portato/plugins/gpytage.py (limited to 'plugins') diff --git a/plugins/gpytage.py b/plugins/gpytage.py new file mode 100644 index 0000000..33509e1 --- /dev/null +++ b/plugins/gpytage.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +# +# File: plugins/gpytage.py +# This file is part of the Portato-Project, a graphical portage-frontend. +# +# Copyright (C) 2008 René 'Necoro' Neumann +# This is free software. You may redistribute copies of it under the terms of +# the GNU General Public License version 2. +# There is NO WARRANTY, to the extent permitted by law. +# +# Written by René 'Necoro' Neumann + +from subprocess import Popen + +class GPytage (Plugin): + __author__ = "René 'Necoro' Neumann" + __description__ = "Adds a menu entry to directly start gpytage, a config editor." + __dependency__ = ["app-portage/gpytage"] + + def __init__ (self): + Plugin.__init__(self) + self.add_menu("Config _Editor", self.menu) + + def menu (self, *args): + Popen(["/usr/bin/gpytage"]) + +register(GPytage) diff --git a/plugins/gpytage.xml b/plugins/gpytage.xml deleted file mode 100644 index b203ae0..0000000 --- a/plugins/gpytage.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - René 'Necoro' Neumann - GPytage - - portato.plugins.gpytage - - - Config _Editor - - - diff --git a/portato/plugins/gpytage.py b/portato/plugins/gpytage.py deleted file mode 100644 index 22cc7ef..0000000 --- a/portato/plugins/gpytage.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# -# File: portato/plugins/gpytage.py -# This file is part of the Portato-Project, a graphical portage-frontend. -# -# Copyright (C) 2008 René 'Necoro' Neumann -# This is free software. You may redistribute copies of it under the terms of -# the GNU General Public License version 2. -# There is NO WARRANTY, to the extent permitted by law. -# -# Written by René 'Necoro' Neumann - -from subprocess import Popen - -def gpytage(*args, **kwargs): - Popen(["/usr/bin/gpytage"]) -- cgit v1.2.3-54-g00ecf From e42090a8bd7dcc5f9e7c6e41b0f44698588e6586 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Thu, 3 Jul 2008 23:33:21 +0200 Subject: Ported etc-proposals plugin --- plugins/etc_proposals.py | 43 ++++++++++++++++++++++++++++++++++++++++ plugins/etc_proposals.xml | 19 ------------------ portato/plugins/etc_proposals.py | 31 ----------------------------- 3 files changed, 43 insertions(+), 50 deletions(-) create mode 100644 plugins/etc_proposals.py delete mode 100644 plugins/etc_proposals.xml delete mode 100644 portato/plugins/etc_proposals.py (limited to 'plugins') diff --git a/plugins/etc_proposals.py b/plugins/etc_proposals.py new file mode 100644 index 0000000..f02cef5 --- /dev/null +++ b/plugins/etc_proposals.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# +# File: plugins/etc_proposals.py +# This file is part of the Portato-Project, a graphical portage-frontend. +# +# Copyright (C) 2007-2008 René 'Necoro' Neumann +# This is free software. You may redistribute copies of it under the terms of +# the GNU General Public License version 2. +# There is NO WARRANTY, to the extent permitted by law. +# +# Written by René 'Necoro' Neumann + +from portato.helper import error + +import os +from subprocess import Popen + +class EtcProposals (Plugin): + __author__ = "René 'Necoro' Neumann" + __description__ = "Adds support for etc-proposals, a graphical etc-update replacement." + __dependency__ = "app-portage/etc-proposals" + + def __init__ (self): + Plugin.__init__(self) + + self.prog = ["/usr/sbin/etc-proposals"] + self.add_call("after_emerge", self.hook, type = "after") + self.add_menu("Et_c-Proposals", self.menu) + + def launch (self, options = []): + if os.getuid() == 0: + Popen(self.prog+options) + else: + error("ETC_PROPOSALS :: %s",_("Cannot start etc-proposals. Not root!")) + + def hook (self, *args, **kwargs): + """Entry point for this plugin.""" + self.launch(["--fastexit"]) + + def menu (self, *args): + self.launch() + +register(EtcProposals) diff --git a/plugins/etc_proposals.xml b/plugins/etc_proposals.xml deleted file mode 100644 index 2caf341..0000000 --- a/plugins/etc_proposals.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - René 'Necoro' Neumann - Etc-proposals - - portato.plugins.etc_proposals - - - - - - - - - Et_c-Proposals - - - diff --git a/portato/plugins/etc_proposals.py b/portato/plugins/etc_proposals.py deleted file mode 100644 index d5f707f..0000000 --- a/portato/plugins/etc_proposals.py +++ /dev/null @@ -1,31 +0,0 @@ -# -*- coding: utf-8 -*- -# -# File: portato/plugins/etc_proposals.py -# This file is part of the Portato-Project, a graphical portage-frontend. -# -# Copyright (C) 2007 René 'Necoro' Neumann -# This is free software. You may redistribute copies of it under the terms of -# the GNU General Public License version 2. -# There is NO WARRANTY, to the extent permitted by law. -# -# Written by René 'Necoro' Neumann - -from portato.helper import error - -import os -from subprocess import Popen - -PROG=["/usr/sbin/etc-proposals"] - -def launch (options = []): - if os.getuid() == 0: - Popen(PROG+options) - else: - error("ETC_PROPOSALS :: %s",_("Cannot start etc-proposals. Not root!")) - -def etc_prop (*args, **kwargs): - """Entry point for this plugin.""" - launch(["--fastexit"]) - -def etc_prop_menu (*args, **kwargs): - launch() -- cgit v1.2.3-54-g00ecf From 8e07fd436cfbf02fbf43c9e221badb55acdb546a Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Fri, 4 Jul 2008 14:15:55 +0200 Subject: Some more dependency awareness --- plugins/etc_proposals.py | 4 +-- plugins/gpytage.py | 3 +-- plugins/notify.py | 12 ++++++--- portato/gui/windows/main.py | 3 +++ portato/plugin.py | 60 ++++++++++++++++++++++++++++++++++----------- 5 files changed, 59 insertions(+), 23 deletions(-) (limited to 'plugins') diff --git a/plugins/etc_proposals.py b/plugins/etc_proposals.py index 07f9a80..c32c8f3 100644 --- a/plugins/etc_proposals.py +++ b/plugins/etc_proposals.py @@ -20,9 +20,7 @@ class EtcProposals (Plugin): __description__ = "Adds support for etc-proposals, a graphical etc-update replacement." __dependency__ = ["app-portage/etc-proposals"] - def __init__ (self): - Plugin.__init__(self) - + def init (self): self.prog = ["/usr/sbin/etc-proposals"] self.add_call("after_emerge", self.hook, type = "after") self.add_menu("Et_c-Proposals", self.menu) diff --git a/plugins/gpytage.py b/plugins/gpytage.py index 33509e1..d8c2831 100644 --- a/plugins/gpytage.py +++ b/plugins/gpytage.py @@ -17,8 +17,7 @@ class GPytage (Plugin): __description__ = "Adds a menu entry to directly start gpytage, a config editor." __dependency__ = ["app-portage/gpytage"] - def __init__ (self): - Plugin.__init__(self) + def init (self): self.add_menu("Config _Editor", self.menu) def menu (self, *args): diff --git a/plugins/notify.py b/plugins/notify.py index bc1b2ea..6446812 100644 --- a/plugins/notify.py +++ b/plugins/notify.py @@ -10,7 +10,12 @@ # # Written by René 'Necoro' Neumann -import pynotify +disable = False + +try: + import pynotify +except ImportError: + disable = True from portato import get_listener @@ -22,8 +27,7 @@ class Notify (Plugin): __description__ = "Show notifications when an emerge process finishes." __dependency__ = ["dev-python/notify-python"] - def __init__ (self): - Plugin.__init__(self) + def init (self): self.add_call("after_emerge", self.notify) def notify (self, retcode, **kwargs): @@ -42,4 +46,4 @@ class Notify (Plugin): get_listener().send_notify(base = text, descr = descr, icon = icon, urgency = urgency) -register(Notify) +register(Notify, disable) diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py index b4e6353..479274d 100644 --- a/portato/gui/windows/main.py +++ b/portato/gui/windows/main.py @@ -1082,6 +1082,9 @@ class MainWindow (Window): def save_plugin (p): def _save (): + if p.status == p.STAT_HARD_DISABLED: + return "" + return int(p.status >= p.STAT_ENABLED) return _save diff --git a/portato/plugin.py b/portato/plugin.py index 7b8a493..ada7a0f 100644 --- a/portato/plugin.py +++ b/portato/plugin.py @@ -19,6 +19,7 @@ from functools import wraps from .helper import debug, warning, info, error from .constants import PLUGIN_DIR +from .backend import system from . import plugins as plugin_module class PluginLoadException (Exception): @@ -52,11 +53,30 @@ class Hook (object): class Plugin (object): (STAT_DISABLED, STAT_TEMP_ENABLED, STAT_ENABLED, STAT_TEMP_DISABLED) = range(4) + STAT_HARD_DISABLED = -1 - def __init__ (self): + def __init__ (self, disable = False): self.__menus = [] self.__calls = [] - self.status = self.STAT_ENABLED + self._unresolved_deps = False + + if not disable: + self.status = self.STAT_ENABLED + else: + self.status = self.STAT_HARD_DISABLED + + def _init (self): + + for d in self.deps: + if not system.find_packages(d, pkgSet="installed", with_version = False): + self._unresolved_deps = True + break + + if self.status != self.STAT_HARD_DISABLED and not self._unresolved_deps: + self.init() + + def init (self): + pass @property def author (self): @@ -140,8 +160,28 @@ class PluginQueue (object): self._organize() - def add (self, plugin): - self.plugins.append(plugin) + def add (self, plugin, disable = False): + if callable(plugin) and Plugin in plugin.__bases__: + p = plugin(disable = disable) # need an instance and not the class + elif isinstance(plugin, Plugin): + p = plugin + if disable: + p.status = p.STAT_HARD_DISABLED + else: + raise PluginLoadException, "Is neither a subclass nor an instance of Plugin." + + p._init() + + self.plugins.append(p) + + if p.status == p.STAT_HARD_DISABLED: + msg = _("Plugin is disabled!") + elif p._unresolved_deps: + msg = _("Plugin has unresolved dependencies - disabled!") + else: + msg = "" + + info("%s %s", _("Plugin '%s' loaded.") % p.name, msg) def hook (self, hook, *hargs, **hkwargs): @@ -298,14 +338,6 @@ def hook(hook, *args, **kwargs): else: return __plugins.hook(hook, *args, **kwargs) -def register (plugin): +def register (plugin, disable = False): if __plugins is not None: - if callable(plugin) and Plugin in plugin.__bases__: - p = plugin() # need an instance and not the class - elif isinstance(plugin, Plugin): - p = plugin - else: - raise PluginLoadException, "Is neither a subclass nor an instance of Plugin." - - info(_("Plugin '%s' loaded."), p.name) - __plugins.add(p) + __plugins.add(plugin, disable) -- cgit v1.2.3-54-g00ecf From 92017bd23d9b29810fb6a5a4987daa810fe5bb42 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Fri, 4 Jul 2008 17:58:19 +0200 Subject: Ported remaining plugins --- plugins/exception.py | 20 +++++++++++ plugins/exception.xml | 13 ------- plugins/new_version.py | 80 ++++++++++++++++++++++++++++++++++++++++++ plugins/new_version.xml | 16 --------- portato/plugins/exception.py | 2 -- portato/plugins/new_version.py | 58 ------------------------------ 6 files changed, 100 insertions(+), 89 deletions(-) create mode 100644 plugins/exception.py delete mode 100644 plugins/exception.xml create mode 100644 plugins/new_version.py delete mode 100644 plugins/new_version.xml delete mode 100644 portato/plugins/exception.py delete mode 100644 portato/plugins/new_version.py (limited to 'plugins') diff --git a/plugins/exception.py b/plugins/exception.py new file mode 100644 index 0000000..e653853 --- /dev/null +++ b/plugins/exception.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# +# File: plugins/exception.py +# This file is part of the Portato-Project, a graphical portage-frontend. +# +# Copyright (C) 2008 René 'Necoro' Neumann +# This is free software. You may redistribute copies of it under the terms of +# the GNU General Public License version 2. +# There is NO WARRANTY, to the extent permitted by law. +# +# Written by René 'Necoro' Neumann + +def throw (*args, **kwargs): + raise Exception, "As requested, Sir!" + +p = Plugin() +p.__name__ = "ExceptionThrower" +p.__author__ = "René 'Necoro' Neumann" +p.add_menu("Throw exception", throw) +register(p) diff --git a/plugins/exception.xml b/plugins/exception.xml deleted file mode 100644 index 385e743..0000000 --- a/plugins/exception.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - René 'Necoro' Neumann - Exception Thrower - - portato.plugins.exception - - - Throw exception - - - diff --git a/plugins/new_version.py b/plugins/new_version.py new file mode 100644 index 0000000..f3479b4 --- /dev/null +++ b/plugins/new_version.py @@ -0,0 +1,80 @@ +# -*- coding: utf-8 -*- +# +# File: plugins/new_version.py +# This file is part of the Portato-Project, a graphical portage-frontend. +# +# Copyright (C) 2008 René 'Necoro' Neumann +# This is free software. You may redistribute copies of it under the terms of +# the GNU General Public License version 2. +# There is NO WARRANTY, to the extent permitted by law. +# +# Written by René 'Necoro' Neumann + +try: + from bzrlib import plugin, branch +except ImportError: + plugin = branch = None +import gobject + +from portato.helper import debug, warning +from portato import get_listener +from portato.constants import VERSION, APP_ICON, APP +from portato.gui.utils import GtkThread + +class NewVersionFinder(Plugin): + """ + Checks for a new version of portato every 30 minutes and on startup. + """ + __author__ = "René 'Necoro' Neumann" + __dependency__ = ["dev-util/bzr"] + + def init (self): + self.add_call("main", self.run) + self.add_menu("Check for new _versions", self.menu) + + def find_version (self, rev): + try: + b = branch.Branch.open("lp:portato") + except Exception, e: + warning("NEW_VERSION :: Exception occured while accessing the remote branch: %s", str(e)) + return + + debug("NEW_VERSION :: Installed rev: %s - Current rev: %s", rev, b.revno()) + if int(rev) < int(b.revno()): + def callback(): + get_listener().send_notify(base = "New Portato Live Version Found", descr = "You have rev. %s, but the most recent revision is %s." % (rev, b.revno()), icon = APP_ICON) + return False + + gobject.idle_add(callback) + + def start_thread(self, rev): + t = GtkThread(target = self.find_version, name = "Version Updater Thread", args = (rev,)) + t.setDaemon(True) + t.start() + return True + + def menu (self, *args, **kwargs): + """ + Run the thread once. + """ + v = VERSION.split() + if len(v) != 3 or v[0] != "9999": + return None + + rev = v[-1] + + plugin.load_plugins() # to have lp: addresses parsed + + self.start_thread(rev) + return rev + + def run (self, *args, **kwargs): + """ + Run the thread once and add a 30 minutes timer. + """ + rev = self.menu() + + if rev is not None: + gobject.timeout_add(30*60*1000, self.start_thread, rev) # call it every 30 minutes + +register(NewVersionFinder, (branch is None)) diff --git a/plugins/new_version.xml b/plugins/new_version.xml deleted file mode 100644 index 2711054..0000000 --- a/plugins/new_version.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - René 'Necoro' Neumann - New Version Reminder - - portato.plugins.new_version - - - - - - - Check for new _versions - - diff --git a/portato/plugins/exception.py b/portato/plugins/exception.py deleted file mode 100644 index 64bdb77..0000000 --- a/portato/plugins/exception.py +++ /dev/null @@ -1,2 +0,0 @@ -def throw (*args, **kwargs): - raise Exception, "As requested, Sir!" diff --git a/portato/plugins/new_version.py b/portato/plugins/new_version.py deleted file mode 100644 index fe69292..0000000 --- a/portato/plugins/new_version.py +++ /dev/null @@ -1,58 +0,0 @@ -try: - from bzrlib import plugin, branch -except ImportError: - plugin = branch = None -import gobject - -from portato.helper import debug, warning -from portato import get_listener -from portato.constants import VERSION, APP_ICON, APP -from portato.gui.utils import GtkThread - -def find_version (rev): - try: - b = branch.Branch.open("lp:portato") - except Exception, e: - warning("NEW_VERSION :: Exception occured while accessing the remote branch: %s", str(e)) - return - - debug("NEW_VERSION :: Installed rev: %s - Current rev: %s", rev, b.revno()) - if int(rev) < int(b.revno()): - def callback(): - get_listener().send_notify(base = "New Portato Live Version Found", descr = "You have rev. %s, but the most recent revision is %s." % (rev, b.revno()), icon = APP_ICON) - return False - - gobject.idle_add(callback) - -def start_thread(rev): - t = GtkThread(target = find_version, name = "Version Updater Thread", args = (rev,)) - t.setDaemon(True) - t.start() - return True - -def run_menu (*args, **kwargs): - """ - Run the thread once. - """ - if not all((plugin, branch)): - return None - - v = VERSION.split() - if len(v) != 3 or v[0] != "9999": - return None - - rev = v[-1] - - plugin.load_plugins() # to have lp: addresses parsed - - start_thread(rev) - return rev - -def run (*args, **kwargs): - """ - Run the thread once and add a 30 minutes timer. - """ - rev = run_menu() - - if rev is not None: - gobject.timeout_add(30*60*1000, start_thread, rev) # call it every 30 minutes -- cgit v1.2.3-54-g00ecf From b21023ecc7dd95339f83ae044ad642b3a863ecef Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Tue, 8 Jul 2008 14:52:57 +0200 Subject: Added the reload_portage plugin --- plugins/reload_portage.py | 27 +++++++++++++++++++++++++++ portato/plugin.py | 13 +++++++++---- 2 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 plugins/reload_portage.py (limited to 'plugins') diff --git a/plugins/reload_portage.py b/plugins/reload_portage.py new file mode 100644 index 0000000..280bd92 --- /dev/null +++ b/plugins/reload_portage.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +# +# File: plugins/reload_portage.py +# This file is part of the Portato-Project, a graphical portage-frontend. +# +# Copyright (C) 2007-2008 René 'Necoro' Neumann +# This is free software. You may redistribute copies of it under the terms of +# the GNU General Public License version 2. +# There is NO WARRANTY, to the extent permitted by law. +# +# Written by René 'Necoro' Neumann + +from portato.backend import system + +class ReloadPortage (Plugin): + __author__ = "René 'Necoro' Neumann" + __description__ = """Reloads portage when an emerge process has finished. +This can take some time, but sometimes it is necessairy.""" + + def init(self): + self.add_call("after_emerge", self.hook, type = "after", dep = "EtcProposals") + self.status = self.STAT_DISABLED # disable by default + + def hook (self, *args, **kwargs): + system.reload_settings() + +register(ReloadPortage) diff --git a/portato/plugin.py b/portato/plugin.py index 5994328..0119909 100644 --- a/portato/plugin.py +++ b/portato/plugin.py @@ -186,7 +186,12 @@ class Plugin (object): if hasattr(self, "__description__"): return self.__description__ else: - return getattr(self, "__doc__", "") + doc = getattr(self, "__doc__", "") + + if not doc or doc == Plugin.__doc__: + return "" + else: + return doc @property def name (self): @@ -218,15 +223,15 @@ class Plugin (object): @property def deps (self): """ - Returns an iterator of the dependencies or ``None`` if there are none. + Returns an iterator of the dependencies or ``[]`` if there are none. The dependencies are given in the ``__dependency__`` variable. - :rtype: None or iter + :rtype: [] or iter """ if hasattr(self, "__dependency__"): return iter(self.__dependency__) else: - return None + return [] @property def enabled (self): -- cgit v1.2.3-54-g00ecf