diff options
Diffstat (limited to 'portato')
-rw-r--r-- | portato/__init__.py | 6 | ||||
-rw-r--r-- | portato/backend/flags.py | 2 | ||||
-rw-r--r-- | portato/backend/portage/package.py | 4 | ||||
-rw-r--r-- | portato/backend/portage/system_22.py | 8 | ||||
-rw-r--r-- | portato/backend/system_interface.py | 4 | ||||
-rw-r--r-- | portato/db/sql.py | 11 | ||||
-rw-r--r-- | portato/gui/queue.py | 9 | ||||
-rw-r--r-- | portato/gui/templates/AboutWindow.ui | 1 | ||||
-rw-r--r-- | portato/gui/windows/main.py | 4 | ||||
-rw-r--r-- | portato/helper.py | 8 | ||||
-rw-r--r-- | portato/plugin.py | 35 | ||||
-rw-r--r-- | portato/waiting_queue.py | 7 |
12 files changed, 65 insertions, 34 deletions
diff --git a/portato/__init__.py b/portato/__init__.py index 4252a0a..60aeec4 100644 --- a/portato/__init__.py +++ b/portato/__init__.py @@ -18,7 +18,7 @@ import subprocess, threading import atexit from optparse import OptionParser, SUPPRESS_HELP -from . import log +from .log import start as logstart from .constants import LOCALE_DIR, APP, VERSION from .su import detect_su_command from .helper import debug, info, error @@ -66,7 +66,7 @@ def start(): gettext.install(APP, LOCALE_DIR, unicode = True) # start logging - log.start(file=False) + logstart(file=False) # run parser (options, args) = get_parser().parse_args() @@ -75,7 +75,7 @@ def start(): atexit.register(get_listener().close) if options.nofork or os.getuid() == 0: # start GUI - log.start(file = True) # start logging to file + logstart(file = True) # start logging to file from .gui import run info("%s v. %s", _("Starting Portato"), VERSION) diff --git a/portato/backend/flags.py b/portato/backend/flags.py index 51e5289..9c5b93d 100644 --- a/portato/backend/flags.py +++ b/portato/backend/flags.py @@ -115,7 +115,7 @@ def get_data(pkg, path): flags = [] for line in grep(pkg, path): - file, line, fl = line.split(":") # get file, line and flag-list + file, line, fl = line.split(":", 2) # get file, line and flag-list fl = fl.split() crit = fl[0] fl = fl[1:] diff --git a/portato/backend/portage/package.py b/portato/backend/portage/package.py index 502ee2b..2b40e41 100644 --- a/portato/backend/portage/package.py +++ b/portato/backend/portage/package.py @@ -308,4 +308,6 @@ class PortagePackage (Package): return portage.pkgcmp(v1[1:],v2[1:]) def matches (self, criterion): - return system.cpv_matches(self.get_cpv(), criterion) + # cpv_matches needs explicit slot info + scpv = "%s:%s" % (self.get_cpv(), self.get_package_settings("SLOT")) + return system.cpv_matches(scpv, criterion) diff --git a/portato/backend/portage/system_22.py b/portato/backend/portage/system_22.py index d720a06..f69e15c 100644 --- a/portato/backend/portage/system_22.py +++ b/portato/backend/portage/system_22.py @@ -63,3 +63,11 @@ class PortageSystem_22 (PortageSystem): def new_package (self, cpv): return PortagePackage_22(cpv) + + def get_config_path (self): + path = PortageSystem.get_config_path(self) + + if path[0] != "/": + return os.path.join(self.settings.settings["ROOT"], path) + else: + return path diff --git a/portato/backend/system_interface.py b/portato/backend/system_interface.py index 43de1ec..be79de2 100644 --- a/portato/backend/system_interface.py +++ b/portato/backend/system_interface.py @@ -108,8 +108,8 @@ class SystemInterface (object): @param key: the key to look for @type key: string - @param all: the package set to use - @type all: string + @param pkgSet: the package set to use + @type pkgSet: string @param masked: if True, also look for masked packages @type masked: boolean @param with_version: if True, return CPVs - else CP diff --git a/portato/db/sql.py b/portato/db/sql.py index 415df92..e79a27d 100644 --- a/portato/db/sql.py +++ b/portato/db/sql.py @@ -58,7 +58,7 @@ class SQLDatabase (Database): else: debug("package.db not existant") - pkg_conn = sql.connect(os.path.join(SESSION_DIR, "package.db")) + pkg_conn = sql.connect(pkgdb) pkg_conn.row_factory = sql.Row if pkgdb_existed and updateFormat: pkg_conn.execute("DROP TABLE packages") @@ -83,15 +83,6 @@ class SQLDatabase (Database): pkg_conn.close() - descr_conn = sql.connect(os.path.join(SESSION_DIR, "descr.db")) - descr_conn.execute(""" - CREATE TABLE IF NOT EXISTS descriptions - ( - cp TEXT, - descr TEXT - )""") - descr_conn.close() - def updated (self): changed = False diff --git a/portato/gui/queue.py b/portato/gui/queue.py index e19f8cb..7c667f9 100644 --- a/portato/gui/queue.py +++ b/portato/gui/queue.py @@ -532,6 +532,15 @@ class EmergeQueue: except ValueError: # no && in command self.doEmerge([],[],{}, command, caller = self.sync) + # syncing portage and DB after emerge sync + def finish (): + debug("Finishing sync...") + system.reload_settings() + self.db.reload() + debug("Sync finished") + + self.threadQueue.put(finish, caller = self.sync) + def kill_emerge (self): """Kills the emerge process.""" if self.process is not None: diff --git a/portato/gui/templates/AboutWindow.ui b/portato/gui/templates/AboutWindow.ui index 550418b..56a7ff6 100644 --- a/portato/gui/templates/AboutWindow.ui +++ b/portato/gui/templates/AboutWindow.ui @@ -27,6 +27,7 @@ Thanks goto: <property name="translator_credits">Catalan - Roger Calvó German - René 'Necoro' Neumann Polish - Tomasz Osiński +Portugese (Brazilian) - Alberto Federman Neto Spanish - Daniel Halens Turkish - Gürkan 'seqizz' Gür</property> <property name="artists">p4r4d0x (inspired by wolfden)</property> diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py index 574fa14..1b67747 100644 --- a/portato/gui/windows/main.py +++ b/portato/gui/windows/main.py @@ -235,6 +235,7 @@ class PackageTable: self.installedCheck.hide() self.maskedCheck.hide() + self.maskedLabel.set_label("") # this is needed for some unknown reason self.maskedLabel.hide() self.testingCheck.hide() self.emergeBtn.set_sensitive(False) @@ -264,8 +265,7 @@ class PackageTable: else: self.maskedCheck.set_active(pkg.is_masked(use_changed = False)) - if reason: - self.maskedLabel.set_label(reason) + self.maskedLabel.set_label(reason) if pkg.is_testing(use_keywords = False) and not pkg.is_testing(use_keywords = True): self.testingCheck.set_label("<i>(%s)</i>" % _("Testing")) diff --git a/portato/helper.py b/portato/helper.py index ec3c70f..d32aa82 100644 --- a/portato/helper.py +++ b/portato/helper.py @@ -17,11 +17,11 @@ from __future__ import absolute_import, with_statement import os, logging -debug = logging.getLogger("portatoLogger").debug -info = logging.getLogger("portatoLogger").info +debug = logging.getLogger("portatoLogger").debug +info = logging.getLogger("portatoLogger").info warning = logging.getLogger("portatoLogger").warning -error = logging.getLogger("portatoLogger").error -critical = logging.getLogger("portatoLogger").critical +error = logging.getLogger("portatoLogger").error +critical = logging.getLogger("portatoLogger").critical def N_ (s): return s diff --git a/portato/plugin.py b/portato/plugin.py index 0da14f1..052dcd0 100644 --- a/portato/plugin.py +++ b/portato/plugin.py @@ -23,6 +23,7 @@ import traceback from collections import defaultdict from functools import wraps +from . import helper from .helper import debug, warning, info, error from .constants import PLUGIN_DIR from .backend import system @@ -300,6 +301,11 @@ class Plugin (object): """ self.__calls.append(Call(self, hook, callable, type, dep)) + def __str__ (self): + return self.name + + __repr__ = __str__ + class WidgetPlugin (Plugin): def __init__ (self, *args, **kwargs): @@ -430,25 +436,34 @@ class PluginQueue (object): plugin_module.__builtins__["Plugin"] = Plugin plugin_module.__builtins__["WidgetPlugin"] = WidgetPlugin plugin_module.__builtins__["register"] = register + plugin_module.__builtins__["helper"] = helper + plugin_module.__builtins__["PluginLoadException"] = PluginLoadException for p in plugins: # import them try: exec "from portato.plugins import %s" % p in {} except PluginLoadException, e: - error(_("Loading plugin '%(plugin)s' failed: %(error)s"), {"plugin" : p, "error" : e.message}) + error(_("Loading plugin module '%(plugin)s' failed: %(error)s"), {"plugin" : p, "error" : e}) except: tb = traceback.format_exc() - error(_("Loading plugin '%(plugin)s' failed: %(error)s"), {"plugin" : p, "error" : tb}) + error(_("Loading plugin module '%(plugin)s' failed: %(error)s"), {"plugin" : p, "error" : tb}) self._organize() def load_widgets(self, window): for p in self.plugins: if isinstance(p, WidgetPlugin): - p._widget_init(window) - for w in p.widgets: - WidgetSlot.slots[w.slot].add_widget(w) - info(_("Widgets of plugin '%s' loaded."), p.name) + try: + p._widget_init(window) + except PluginLoadException, e: + error(_("Loading widgets plugin '%(plugin)s' failed: %(error)s"), {"plugin" : p, "error" : e}) + except: + tb = traceback.format_exc() + error(_("Loading widgets of plugin '%(plugin)s' failed: %(error)s"), {"plugin" : p, "error" : tb}) + else: + for w in p.widgets: + WidgetSlot.slots[w.slot].add_widget(w) + info(_("Widgets of plugin '%s' loaded."), p.name) def add (self, plugin, disable = False): """ @@ -683,4 +698,10 @@ def register (plugin, disable = False): :see: `PluginQueue.add` """ if __plugins is not None: - __plugins.add(plugin, disable) + try: + __plugins.add(plugin, disable) + except PluginLoadException, e: + error(_("Registrating plugin '%(plugin)s' failed: %(error)s"), {"plugin" : plugin, "error" : e}) + except: + tb = traceback.format_exc() + error(_("Registrating plugin '%(plugin)s' failed: %(error)s"), {"plugin" : plugin, "error" : tb}) diff --git a/portato/waiting_queue.py b/portato/waiting_queue.py index d946abe..33791a3 100644 --- a/portato/waiting_queue.py +++ b/portato/waiting_queue.py @@ -36,10 +36,9 @@ class WaitingQueue (Queue): def put (self, method, *args, **kwargs): self.counter += 1; - if "caller" in kwargs: - name = "Waiting Thread #%d (called by:%s)" % (self.counter, kwargs["caller"]) - del kwargs["caller"] - else: + try: + name = "Waiting Thread #%d (called by:%s)" % (self.counter, kwargs.pop("caller")) + except KeyError: name = "Waiting Thread #%d" % self.counter t = self.threadClass(name = name, target = method, args = args, kwargs = kwargs) |