From 66df5c58c999b92af900b7a382cb2a7025c4b66a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Thu, 17 Apr 2008 21:25:31 +0200 Subject: Enhanced get_use_desc - similar to the 'unify' branch --- portato/backend/portage/system.py | 84 +++++++++++++++++++++------------------ 1 file changed, 45 insertions(+), 39 deletions(-) (limited to 'portato') diff --git a/portato/backend/portage/system.py b/portato/backend/portage/system.py index ef3feb9..a3583b1 100644 --- a/portato/backend/portage/system.py +++ b/portato/backend/portage/system.py @@ -3,17 +3,18 @@ # File: portato/backend/portage/system.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2007 René 'Necoro' Neumann +# Copyright (C) 2006-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 __future__ import absolute_import +from __future__ import absolute_import, with_statement -import re, os +import re, os, os.path import portage +from collections import defaultdict from .package import PortagePackage from .settings import PortageSettings @@ -30,7 +31,10 @@ class PortageSystem (SystemInterface): def __init__ (self): """Constructor.""" self.settings = PortageSettings() - portage.WORLD_FILE = self.settings.settings["ROOT"]+portage.WORLD_FILE + portage.WORLD_FILE = os.path.join(self.settings.settings["ROOT"],portage.WORLD_FILE) + + self.use_descs = {} + self.local_use_descs = defaultdict(dict) def get_version (self): return "Portage %s" % portage.VERSION @@ -461,46 +465,48 @@ class PortageSystem (SystemInterface): check(p, True) return updating - - use_descs = {} - local_use_descs = {} + def get_use_desc (self, flag, package = None): # In the first run the dictionaries 'use_descs' and 'local_use_descs' are filled. # fill cache if needed - if self.use_descs == {} or self.local_use_descs == {}: - # read use.desc - fd = open(self.settings.settings["PORTDIR"]+"/profiles/use.desc") - lines = fd.readlines() - fd.close() - for line in lines: - line = line.strip() - if line != "" and line[0] != '#': - fields = [x.strip() for x in line.split(" - ",1)] - if len(fields) == 2: - self.use_descs[fields[0]] = fields[1] - - # read use.local.desc - fd = open(self.settings.settings["PORTDIR"]+"/profiles/use.local.desc") - lines = fd.readlines() - fd.close() - for line in lines: - line = line.strip() - if line != "" and line[0] != '#': - fields = [x.strip() for x in line.split(":",1)] - if len(fields) == 2: - if not fields[0] in self.local_use_descs: # create - self.local_use_descs[fields[0]] = {} - subfields = [x.strip() for x in fields[1].split(" - ",1)] - if len(subfields) == 2: - self.local_use_descs[fields[0]][subfields[0]] = subfields[1] + if not self.use_descs and not self.local_use_descs: + for dir in [self.settings.settings["PORTDIR"]] + self.settings.settings["PORTDIR_OVERLAY"].split(): + + # read use.desc + try: + f = open(os.path.join(dir, "profiles/use.desc")) + for line in f: + line = line.strip() + if line and line[0] != '#': + fields = [x.strip() for x in line.split(" - ",1)] + if len(fields) == 2: + self.use_descs[fields[0]] = fields[1] + except IOError: + pass + finally: + f.close() + + # read use.local.desc + try: + f = open(os.path.join(dir, "profiles/use.local.desc")) + for line in f: + line = line.strip() + if line and line[0] != '#': + fields = [x.strip() for x in line.split(":",1)] + if len(fields) == 2: + subfields = [x.strip() for x in fields[1].split(" - ",1)] + if len(subfields) == 2: + self.local_use_descs[fields[0]].update([subfields]) + except IOError: + pass + finally: + f.close() # start - desc = "" - if flag in self.use_descs: - desc = self.use_descs[flag] - if package != None: + desc = self.use_descs.get(flag, "") + if package is not None: if package in self.local_use_descs: - if flag in self.local_use_descs[package]: - desc = self.local_use_descs[package][flag] + desc = self.local_use_descs[package].get(flag, desc) + return desc -- cgit v1.2.3 From 04f1ccf7b2c4c16d0d1b1fc975182b66964d055e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Fri, 18 Apr 2008 00:04:10 +0200 Subject: Only init dbus threads, if it is really needed. --- portato/plugins/dbus_init.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'portato') diff --git a/portato/plugins/dbus_init.py b/portato/plugins/dbus_init.py index 851562c..653af31 100644 --- a/portato/plugins/dbus_init.py +++ b/portato/plugins/dbus_init.py @@ -1,4 +1,10 @@ -from dbus.mainloop.glib import threads_init +try: + from dbus.mainloop.glib import threads_init +except ImportError: + threads_init = None + +from portato.constants import USE_CATAPULT def dbus_init (*args): - threads_init() + if USE_CATAPULT and threads_init is not None: + threads_init() -- cgit v1.2.3 From e4f0e899d681aeb3577054644b032101e3cd2d16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Fri, 18 Apr 2008 00:53:14 +0200 Subject: Added seqizz' nick to the translators listings --- portato/gui/templates/AboutWindow.glade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'portato') diff --git a/portato/gui/templates/AboutWindow.glade b/portato/gui/templates/AboutWindow.glade index 57708d9..fe041c4 100644 --- a/portato/gui/templates/AboutWindow.glade +++ b/portato/gui/templates/AboutWindow.glade @@ -28,7 +28,7 @@ Thanks goto: Catalan - Roger Calvó German - René 'Necoro' Neumann Polish - Tomasz Osiński -Turkish - Gürkan Gür +Turkish - Gürkan 'seqizz' Gür p4r4d0x (inspired by wolfden) -- cgit v1.2.3 From 4cc1e681aaec4accbc72f33f51677d9aded037cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Fri, 18 Apr 2008 01:55:15 +0200 Subject: Fixed update world to fit current portage handling --- portato/backend/portage/system.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'portato') diff --git a/portato/backend/portage/system.py b/portato/backend/portage/system.py index a3583b1..10fa9bc 100644 --- a/portato/backend/portage/system.py +++ b/portato/backend/portage/system.py @@ -36,6 +36,8 @@ class PortageSystem (SystemInterface): self.use_descs = {} self.local_use_descs = defaultdict(dict) + self._version = tuple([x.split("_")[0] for x in portage.VERSION.split(".")]) + def get_version (self): return "Portage %s" % portage.VERSION @@ -155,7 +157,7 @@ class PortageSystem (SystemInterface): return PortagePackage(portage.best(list)) def find_best_match (self, search_key, masked = False, only_installed = False, only_cpv = False): - t = None + t = [] if not only_installed: try: @@ -173,11 +175,14 @@ class PortageSystem (SystemInterface): t += self.settings.porttree.dbapi.match(cp) else: raise - else: - t = self.find_installed_packages(search_key, masked, only_cpv = True) + + if self._version >= (2,1,5) or only_installed: + t += [pkg.get_cpv() for pkg in self.find_installed_packages(search_key) if not pkg.is_masked()] if t: + t = unique_array(t) return self.find_best(t, only_cpv) + return None def find_packages (self, search_key, masked=False, only_cpv = False): @@ -373,7 +378,7 @@ class PortageSystem (SystemInterface): # append system packages packages.extend(unique_array([p.get_cp() for p in self.find_all_system_packages()])) - states = [(["RDEPEND"], True)] + states = [(["RDEPEND", "PDEPEND"], True)] if self.with_bdeps(): states.append((["DEPEND"], True)) -- cgit v1.2.3 From 92443dcb6dd74e67899553ab58ce1a30560bd8dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Mon, 21 Apr 2008 23:10:37 +0200 Subject: Added shortcut for 'Reload Portage' - increased max. scrollback lines --- portato/gui/templates/MainWindow.glade | 194 +++++++++++++++++---------------- portato/gui/windows/main.py | 2 +- 2 files changed, 99 insertions(+), 97 deletions(-) (limited to 'portato') diff --git a/portato/gui/templates/MainWindow.glade b/portato/gui/templates/MainWindow.glade index 7422126..788a339 100644 --- a/portato/gui/templates/MainWindow.glade +++ b/portato/gui/templates/MainWindow.glade @@ -1,6 +1,6 @@ - + 2 @@ -46,6 +46,8 @@ Re_load Portage True + + True @@ -614,271 +616,271 @@ - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK True 0 - label + use flags + PANGO_ELLIPSIZE_END True 1 2 - 3 - 4 + 4 + 5 - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True 0 - <b>License:</b> + <b>Use Flags:</b> True True - 3 - 4 + 4 + 5 GTK_FILL 5 - + True + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK True - <b>Installed, but not in portage anymore</b> - True + Testing + 0 + 0 + True + - 2 - 5 - 6 + 7 + 8 + GTK_FILL - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - True - <span foreground='red'><b>MISSING KEYWORD</b></span> - True + 0 + 1 2 - 5 - 6 + 8 + 9 - + True + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 5 - - - + True + Masked + 0 + 0 + True + - 1 - 2 - 2 - 3 + 8 + 9 + GTK_FILL - + True + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + Installed 0 - <b>Description:</b> - True - True + 0 + True + + 6 + 7 GTK_FILL - 5 - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - True 0 - <b>Overlay:</b> + <b>Homepage:</b> True True - 1 - 2 + 2 + 3 GTK_FILL 5 - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True 0 label - True + True 1 2 + 1 + 2 - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - True 0 label - True + True 1 2 - 1 - 2 - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True 0 - <b>Homepage:</b> + <b>Overlay:</b> True True - 2 - 3 + 1 + 2 GTK_FILL 5 - + True - True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - True - Installed 0 - 0 - True - + <b>Description:</b> + True + True - 6 - 7 GTK_FILL + 5 - + True - True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - True - Masked - 0 - 0 - True - + 5 + + + - 8 - 9 - GTK_FILL + 1 + 2 + 2 + 3 - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 + True + <span foreground='red'><b>MISSING KEYWORD</b></span> + True - 1 2 - 8 - 9 + 5 + 6 - + True - True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK True - Testing - 0 - 0 - True - + <b>Installed, but not in portage anymore</b> + True - 7 - 8 - GTK_FILL + 2 + 5 + 6 - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - True 0 - <b>Use Flags:</b> + <b>License:</b> True True - 4 - 5 + 3 + 4 GTK_FILL 5 - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK True 0 - use flags - PANGO_ELLIPSIZE_END + label True 1 2 - 4 - 5 + 3 + 4 diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py index 99739ae..314a500 100644 --- a/portato/gui/windows/main.py +++ b/portato/gui/windows/main.py @@ -829,7 +829,7 @@ class MainWindow (Window): Builds the terminal. """ - self.console.set_scrollback_lines(1024) + self.console.set_scrollback_lines(2**30) self.console.set_scroll_on_output(True) self.console.set_font_from_string(self.cfg.get("consolefont", "GUI")) self.console.connect("button-press-event", self.cb_right_click) -- cgit v1.2.3 From 57fdab2f3e379d0e2ab7a3a394f3ff129f3efa34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Tue, 29 Apr 2008 19:13:24 +0200 Subject: Changed max scrollback lines to 2**20 to prevent segfaults --- portato/gui/windows/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'portato') diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py index 314a500..5dffad3 100644 --- a/portato/gui/windows/main.py +++ b/portato/gui/windows/main.py @@ -829,7 +829,7 @@ class MainWindow (Window): Builds the terminal. """ - self.console.set_scrollback_lines(2**30) + self.console.set_scrollback_lines(2**20) self.console.set_scroll_on_output(True) self.console.set_font_from_string(self.cfg.get("consolefont", "GUI")) self.console.connect("button-press-event", self.cb_right_click) -- cgit v1.2.3 From a28492883e6d11b79856a14b4da5d1074e42f99f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Thu, 1 May 2008 20:46:39 +0200 Subject: Fixed small bug --- portato/gui/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'portato') diff --git a/portato/gui/utils.py b/portato/gui/utils.py index 151ec22..dc9b9f3 100644 --- a/portato/gui/utils.py +++ b/portato/gui/utils.py @@ -204,7 +204,7 @@ class Database (object): else: ninst = [] for pkg in self._db[cat]: - if pkg[2]: + if pkg.inst: yield pkg else: ninst.append(pkg) -- cgit v1.2.3 From 496036eaf6faac0f32e8d746f1d8b34f460cedb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Fri, 2 May 2008 01:37:50 +0200 Subject: Added pause systray icon --- portato/gui/windows/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'portato') diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py index 5dffad3..88f95c4 100644 --- a/portato/gui/windows/main.py +++ b/portato/gui/windows/main.py @@ -25,7 +25,7 @@ from ...backend import flags, system # must be the first to avoid circular deps from ... import get_listener, plugin, dependency from ...helper import debug, warning, error, info, unique_array from ...session import Session -from ...constants import CONFIG_LOCATION, VERSION, APP_ICON +from ...constants import CONFIG_LOCATION, VERSION, APP_ICON, ICON_DIR from ...backend.exceptions import PackageNotFoundException, BlockedException # more GUI stuff @@ -1599,8 +1599,10 @@ class MainWindow (Window): self.emergePaused = cb.get_active() if not self.emergePaused: self.queue.continue_emerge() + self.tray.set_from_file(APP_ICON) else: self.queue.stop_emerge() + self.tray.set_from_file(os.path.join(ICON_DIR, "pausing.png")) # block the handlers of the other buttons # so that calling "set_active" does not call this callback recursivly -- cgit v1.2.3 From 287b37a3d437f5ebc44770819adbb5daca2d3449 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Fri, 2 May 2008 15:05:39 +0200 Subject: Use only global shm --- portato/plistener.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'portato') diff --git a/portato/plistener.py b/portato/plistener.py index 1a5197a..8d35ece 100644 --- a/portato/plistener.py +++ b/portato/plistener.py @@ -90,13 +90,7 @@ class PListener (object): self._sig = None self._rw = None else: - try: # local version - from _shm import shm_wrapper as shm - except ImportError: - try: # version installed together with portato - from portato._shm import shm_wrapper as shm - except ImportError: # the normal shm module - import shm_wrapper as shm + import shm_wrapper as shm self._mem = shm.SharedMemoryHandle(mem) self._sig = shm.SemaphoreHandle(sig) -- cgit v1.2.3 From 364faebfc4db1d907affe5eb093f8d53fea9657d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Sat, 3 May 2008 14:34:28 +0200 Subject: Added python version to traceback --- portato/gui/exception_handling.py | 1 + 1 file changed, 1 insertion(+) (limited to 'portato') diff --git a/portato/gui/exception_handling.py b/portato/gui/exception_handling.py index 6bda133..29cd4e6 100644 --- a/portato/gui/exception_handling.py +++ b/portato/gui/exception_handling.py @@ -118,6 +118,7 @@ def get_version_infos(): return "\n".join(( "Portato version: %s" % VERSION, + "Python version: %s" % sys.version, "Used backend: %s" % system.get_version(), "pygtk: %s (using GTK+: %s)" % (convert(gtk.pygtk_version), convert(gtk.gtk_version)), "pygobject: %s (using GLib: %s)" % (convert(gobject.pygobject_version), convert(gobject.glib_version)), -- cgit v1.2.3 From 8ad9b9d4cbe16aeb9d3545ccde89d675f398f04d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Thu, 15 May 2008 21:46:12 +0200 Subject: Fixed spelling --- portato/gui/templates/UpdateWindow.glade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'portato') diff --git a/portato/gui/templates/UpdateWindow.glade b/portato/gui/templates/UpdateWindow.glade index 4cc678a..2bf712e 100644 --- a/portato/gui/templates/UpdateWindow.glade +++ b/portato/gui/templates/UpdateWindow.glade @@ -1,10 +1,10 @@ - + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Updateble Packages + Updatable Packages GTK_WIN_POS_CENTER_ON_PARENT True True -- cgit v1.2.3 From f8e2398f5d965e43c860f79739c0934652ff4c56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Fri, 16 May 2008 17:47:27 +0200 Subject: Fixed 'find_best_match' and 'update_world' to better mimic portage's behavior --- portato/backend/portage/system.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'portato') diff --git a/portato/backend/portage/system.py b/portato/backend/portage/system.py index 10fa9bc..459fe07 100644 --- a/portato/backend/portage/system.py +++ b/portato/backend/portage/system.py @@ -177,7 +177,7 @@ class PortageSystem (SystemInterface): raise if self._version >= (2,1,5) or only_installed: - t += [pkg.get_cpv() for pkg in self.find_installed_packages(search_key) if not pkg.is_masked()] + t += [pkg.get_cpv() for pkg in self.find_installed_packages(search_key) if not (pkg.is_testing(True) or pkg.is_masked())] if t: t = unique_array(t) @@ -454,7 +454,7 @@ class PortageSystem (SystemInterface): else: for pkg in bm: if not pkg: continue - if pkg.is_masked() or pkg.is_testing(True): # check to not update unnecessairily + if not pkg.is_installed() and (pkg.is_masked() or pkg.is_testing(True)): # check to not update unnecessairily cont = False for inst in self.find_installed_packages(pkg.get_cp(), only_cpv = True): if self.cpv_matches(inst, i): -- cgit v1.2.3 From c24b4970e48771a32155cbc79060c76d218fdd85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Fri, 16 May 2008 17:58:58 +0200 Subject: Fixed copyright string --- portato/gui/templates/AboutWindow.glade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'portato') diff --git a/portato/gui/templates/AboutWindow.glade b/portato/gui/templates/AboutWindow.glade index fe041c4..d5cfbef 100644 --- a/portato/gui/templates/AboutWindow.glade +++ b/portato/gui/templates/AboutWindow.glade @@ -16,7 +16,7 @@ False Portato This software is licensed under the terms of the GPLv2. -Copyright (C) 2006-2007 René 'Necoro' Neumann <necoro@necoro.net> +Copyright (C) 2006-2008 René 'Necoro' Neumann <necoro@necoro.net> A Portage GUI http://portato.necoro.net René 'Necoro' Neumann -- cgit v1.2.3