diff options
56 files changed, 263 insertions, 218 deletions
diff --git a/doc/Changelog b/doc/Changelog index aaec860..1981cf9 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,10 +1,12 @@ next: -- add (experimental) support for sqlite db +- add support for sqlite db - improvements in session handling - sort by useflags in dependency list - make uselist and deplist lazy - i.e. load only if needed - remembers the height and width of the preference window -- bugs fixed: #44, #41 +- debug improvements +- check prerequisites before starting +- bugs fixed: #44, #41, #15, #47 0.11.1: - bugfixes @@ -2,8 +2,8 @@ msgid "" msgstr "" "Project-Id-Version: Portato\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-01-28 00:59+0100\n" -"PO-Revision-Date: 2009-01-28 01:00+0100\n" +"POT-Creation-Date: 2009-02-17 00:14+0100\n" +"PO-Revision-Date: 2009-02-17 00:15+0100\n" "Last-Translator: René 'Necoro' Neumann <necoro@necoro.net>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -647,21 +647,29 @@ msgstr "Wirklich die gesamte Queue löschen?" msgid "A prerequisite for starting Portato was not matched." msgstr "Eine Vorbedingung um Portato zu starten ist nicht erfüllt." -#: portato/gui/views.py:84 +#: portato/gui/dialogs.py:115 +msgid "" +"<b>Note</b>: On fresh Sabayon installs or its LiveDVD/-CD, there is no portage tree existing per default.\n" +"Please run <i>emerge --sync && layman -S</i>." +msgstr "" +"<b>Hinweis</b>: Auf frisch installierten Sabayon-Systemen bzw. der Sabayon LiveDVD/-CD existiert standardmäßig kein Portage-Tree.\n" +"Bitte führe <i>emerge --sync && layman -S</i> aus." + +#: portato/gui/views.py:85 msgid "Package is not installed" msgstr "Paket ist nicht installiert" -#: portato/gui/views.py:101 +#: portato/gui/views.py:102 #, python-format msgid "No %(old)s language file installed. Falling back to %(new)s." msgstr "Keine \"%(old)s\" Syntaxdatei gefunden. Benutze \"%(new)s\"-Syntax." -#: portato/gui/views.py:110 +#: portato/gui/views.py:111 #, python-format msgid "No %(old)s language file installed. Disable highlighting." msgstr "Keine \"%(old)s\" Syntaxdatei gefunden. Deaktiviere Hervorhebung." -#: portato/gui/views.py:129 +#: portato/gui/views.py:130 #: portato/gui/windows/main.py:536 #, python-format msgid "Error: %s" @@ -914,7 +922,7 @@ msgstr "Leere Datenbank..." msgid "Populating database..." msgstr "Fülle Datenbank..." -#: portato/backend/flags.py:527 +#: portato/backend/flags.py:528 #, python-format msgid "Conflicting values for masking status: %s" msgstr "Konflikt beim Masking-Status: %s" @@ -939,7 +947,7 @@ msgstr "Es konnte kein bester Treffer für das Paket '%(package)s' ermittelt wer msgid "BUG in flags.new_masking_status. It returns '%s'" msgstr "BUG in flags.new_masking_status. Es gibt '%s' zurück." -#: portato/helper.py:76 +#: portato/helper.py:87 msgid "Invalid dependency string" msgstr "Ungültiger Dependency-String." diff --git a/i18n/messages.pot b/i18n/messages.pot index c3e73e2..900500c 100644 --- a/i18n/messages.pot +++ b/i18n/messages.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-01-28 00:59+0100\n" +"POT-Creation-Date: 2009-02-17 00:14+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -630,21 +630,28 @@ msgstr "" msgid "A prerequisite for starting Portato was not matched." msgstr "" -#: portato/gui/views.py:84 +#: portato/gui/dialogs.py:115 +msgid "" +"<b>Note</b>: On fresh Sabayon installs or its LiveDVD/-CD, there is no " +"portage tree existing per default.\n" +"Please run <i>emerge --sync && layman -S</i>." +msgstr "" + +#: portato/gui/views.py:85 msgid "Package is not installed" msgstr "" -#: portato/gui/views.py:101 +#: portato/gui/views.py:102 #, python-format msgid "No %(old)s language file installed. Falling back to %(new)s." msgstr "" -#: portato/gui/views.py:110 +#: portato/gui/views.py:111 #, python-format msgid "No %(old)s language file installed. Disable highlighting." msgstr "" -#: portato/gui/views.py:129 portato/gui/windows/main.py:536 +#: portato/gui/views.py:130 portato/gui/windows/main.py:536 #, python-format msgid "Error: %s" msgstr "" @@ -904,7 +911,7 @@ msgstr "" msgid "Populating database..." msgstr "" -#: portato/backend/flags.py:527 +#: portato/backend/flags.py:528 #, python-format msgid "Conflicting values for masking status: %s" msgstr "" @@ -930,7 +937,7 @@ msgstr "" msgid "BUG in flags.new_masking_status. It returns '%s'" msgstr "" -#: portato/helper.py:76 +#: portato/helper.py:87 msgid "Invalid dependency string" msgstr "" diff --git a/plugins/etc_proposals.py b/plugins/etc_proposals.py index 5b4f67a..bb8ce5a 100644 --- a/plugins/etc_proposals.py +++ b/plugins/etc_proposals.py @@ -3,7 +3,7 @@ # File: plugins/etc_proposals.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2007-2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/plugins/exception.py b/plugins/exception.py index ff5a8e9..0dc6105 100644 --- a/plugins/exception.py +++ b/plugins/exception.py @@ -3,7 +3,7 @@ # File: plugins/exception.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/plugins/gpytage.py b/plugins/gpytage.py index 5ebd6b4..43678ec 100644 --- a/plugins/gpytage.py +++ b/plugins/gpytage.py @@ -3,7 +3,7 @@ # File: plugins/gpytage.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/plugins/new_version.py b/plugins/new_version.py index 5391507..7e4d3c0 100644 --- a/plugins/new_version.py +++ b/plugins/new_version.py @@ -3,7 +3,7 @@ # File: plugins/new_version.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/plugins/notify.py b/plugins/notify.py index 7a3776a..8f21de5 100644 --- a/plugins/notify.py +++ b/plugins/notify.py @@ -3,7 +3,7 @@ # File: plugins/notify.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2007-2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/plugins/reload_portage.py b/plugins/reload_portage.py index 1aea01f..539e949 100644 --- a/plugins/reload_portage.py +++ b/plugins/reload_portage.py @@ -3,7 +3,7 @@ # File: plugins/reload_portage.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2007-2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/backend/__init__.py b/portato/backend/__init__.py index 4a4144a..8eae806 100644 --- a/portato/backend/__init__.py +++ b/portato/backend/__init__.py @@ -3,7 +3,7 @@ # File: portato/backend/__init__.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2007 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/backend/exceptions.py b/portato/backend/exceptions.py index 46b2a3e..f20a33e 100644 --- a/portato/backend/exceptions.py +++ b/portato/backend/exceptions.py @@ -3,7 +3,7 @@ # File: portato/backend/exceptions.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2007 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/backend/flags.py b/portato/backend/flags.py index 56df231..baa1f37 100644 --- a/portato/backend/flags.py +++ b/portato/backend/flags.py @@ -3,7 +3,7 @@ # File: portato/backend/flags.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. @@ -203,10 +203,10 @@ def sort_use_flag_list (flaglist): """ def flag_key (flag): - if flag[0] in "+-": - return flag[1:] - else: - return flag + if flag[0] in "+-": + return flag[1:] + else: + return flag flaglist.sort(key = flag_key) return flaglist @@ -262,7 +262,7 @@ def set_use_flag (pkg, flag): if pkg.matches(crit): # we have the inverted flag in the uselist/newuselist --> delete it if invFlag in flags or (file, line, invFlag, False) in newUseFlags[cpv] or (file, line, flag, True) in newUseFlags[cpv]: - if added: del newUseFlags[-1] # we currently added it as an extra option - delete it + if added: del newUseFlags[cpv][-1] # we currently added it as an extra option - delete it added = True jumpOut = False for t in ((file, line, invFlag, False),(file, line, flag, True)): @@ -343,22 +343,22 @@ def write_use_flags (): """This writes our changed useflags into the file.""" global newUseFlags, useFlags + def combine (list): + """Shortcut for reverting the list into a string.""" + return " ".join(list)+"\n" + def insert (flag, list): """Shortcut for inserting a new flag right after the package-name.""" list.insert(1,flag) def remove (flag, list): """Removes a flag.""" - try: - list.remove(flag) - except ValueError: # flag is given as flag\n - list.remove(flag+"\n") - list.append("\n") #re-insert the newline + list.remove(flag) # no more flags there - comment it out - if len(list) == 1 or list[1][0] in ("#","\n"): + if len(list) == 1 or list[1][0] == "#": list[0] = "#"+list[0] - insert("#removed by portato#",list) + list.append("#removed by portato#") file_cache = {} # cache for having to read the file only once: name->[lines] for cpv in newUseFlags: @@ -381,14 +381,14 @@ def write_use_flags (): while i < line: # stop at the given line lines.append(f.readline()) i += 1 - l = f.readline().split(" ") + l = f.readline().split() # delete or insert if delete: remove(flag,l) else: insert(flag,l) - lines.append(" ".join(l)) + lines.append(combine(l)) # read the rest lines.extend(f.readlines()) @@ -396,33 +396,34 @@ def write_use_flags (): file_cache[file] = lines else: # in cache - l = file_cache[file][line-1].split(" ") + l = file_cache[file][line-1].split() if delete: remove(flag, l) else: - insert(flag,l) - file_cache[file][line-1] = " ".join(l) + insert(flag, l) + file_cache[file][line-1] = combine(l) if flagsToAdd: # write new lines msg = "\n#portato update#\n" + comb = combine(flagsToAdd) if CONFIG["usePerVersion"]: # add on a per-version-base - msg += "=%s %s\n" % (cpv, ' '.join(flagsToAdd)) + msg += "=%s %s" % (cpv, comb) else: # add on a per-package-base list = system.split_cpv(cpv) - msg += "%s/%s %s\n" % (list[0], list[1], ' '.join(flagsToAdd)) + msg += "%s/%s %s" % (list[0], list[1], combine) + if not file in file_cache: - f = open(file, "a") - f.write(msg) - f.close() + with open(file, "a") as f: + f.write(msg) else: file_cache[file].append(msg) # write to disk - for file in file_cache.keys(): - f = open(file, "w") - f.writelines(file_cache[file]) - f.close() + for file in file_cache: + with open(file, "w") as f: + f.writelines(file_cache[file]) + # reset useFlags = {} newUseFlags = {} diff --git a/portato/backend/package.py b/portato/backend/package.py index bcc209a..8a80fd5 100644 --- a/portato/backend/package.py +++ b/portato/backend/package.py @@ -3,7 +3,7 @@ # File: portato/backend/package.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/backend/portage/__init__.py b/portato/backend/portage/__init__.py index 67eebfa..1daf51b 100644 --- a/portato/backend/portage/__init__.py +++ b/portato/backend/portage/__init__.py @@ -3,7 +3,7 @@ # File: portato/backend/portage/__init__.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2007 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/backend/portage/package.py b/portato/backend/portage/package.py index 2c913f9..e1813bf 100644 --- a/portato/backend/portage/package.py +++ b/portato/backend/portage/package.py @@ -222,11 +222,14 @@ class PortagePackage (Package): continue if return_blocks: + if not blocked: + if not system.find_packages(dep, masked = True): continue # well - no packages affected - ignore + if with_criterions: dep_pkgs.append((dep, dep)) else: dep_pkgs.append(dep) - else: + elif blocked: raise BlockedException, (self.get_cpv(), blocked[0].get_cpv()) continue # finished with the blocking one -> next diff --git a/portato/backend/portage/package_22.py b/portato/backend/portage/package_22.py index 1dae1fe..ed804ce 100644 --- a/portato/backend/portage/package_22.py +++ b/portato/backend/portage/package_22.py @@ -3,7 +3,7 @@ # File: portato/backend/portage/package_22.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/backend/portage/sets.py b/portato/backend/portage/sets.py index 53025ab..dd8257d 100644 --- a/portato/backend/portage/sets.py +++ b/portato/backend/portage/sets.py @@ -3,7 +3,7 @@ # File: portato/backend/portage/sets.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. @@ -52,7 +52,7 @@ class FilterSet (Set): t = set() for pkg in self.get_list(): if is_regexp and key: - if not re.match(key, pkg, re.I): continue + if not re.search(key, pkg, re.I): continue if not with_version: t.add(portage.dep.dep_getkey(pkg)) @@ -63,12 +63,11 @@ class FilterSet (Set): class PortageSet (FilterSet): def __init__ (self, name): - FilterSet.__init__(self) debug("Loading portage set '%s'", name) - self.portageSet = system.settings.setsconfig.getSets()[name] + self.name = name def get_list(self): - return itt.imap(str, self.portageSet.getAtoms()) + return itt.imap(str, system.settings.setsconfig.getSetAtoms(self.name)) class SystemSet (FilterSet): @@ -86,6 +85,9 @@ class WorldSet (FilterSet): yield cp class InstalledSet (Set): + """For the moment do not use the portage-2.2 @installed set. + It only contains the current slot-cps - and to get the cpvs + via the PortageSet results in an infinite recursion :(.""" def get_pkgs (self, key, is_regexp, masked, with_version, only_cpv): if is_regexp: @@ -95,7 +97,7 @@ class InstalledSet (Set): t = system.settings.vartree.dbapi.cp_all() if key: - t = filter(lambda x: re.match(key, x, re.I), t) + t = filter(lambda x: re.search(key, x, re.I), t) return set(t) else: @@ -111,7 +113,7 @@ class TreeSet (Set): t = system.settings.porttree.dbapi.cp_all() if key: - t = filter(lambda x: re.match(key, x, re.I), t) + t = filter(lambda x: re.search(key, x, re.I), t) elif masked: t = system.settings.porttree.dbapi.xmatch("match-all", key) diff --git a/portato/backend/portage/settings.py b/portato/backend/portage/settings.py index 155e847..8211f3b 100644 --- a/portato/backend/portage/settings.py +++ b/portato/backend/portage/settings.py @@ -3,7 +3,7 @@ # File: portato/backend/portage/settings.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2007 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/backend/portage/settings_22.py b/portato/backend/portage/settings_22.py index 5274b3b..bae3424 100644 --- a/portato/backend/portage/settings_22.py +++ b/portato/backend/portage/settings_22.py @@ -3,7 +3,7 @@ # File: portato/backend/portage/settings_22.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/backend/portage/system.py b/portato/backend/portage/system.py index 24016dc..94b5ca1 100644 --- a/portato/backend/portage/system.py +++ b/portato/backend/portage/system.py @@ -3,7 +3,7 @@ # File: portato/backend/portage/system.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/backend/portage/system_22.py b/portato/backend/portage/system_22.py index 8ce3cd9..d720a06 100644 --- a/portato/backend/portage/system_22.py +++ b/portato/backend/portage/system_22.py @@ -3,7 +3,7 @@ # File: portato/backend/portage/system_22.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. @@ -32,10 +32,10 @@ class PortageSystem_22 (PortageSystem): self.local_use_descs = defaultdict(dict) self.setmap = { - self.SET_ALL : syssets.AllSet, - self.SET_INSTALLED : syssets.InstalledSet, - self.SET_UNINSTALLED : syssets.UninstalledSet, - self.SET_TREE : syssets.TreeSet + self.SET_ALL : syssets.AllSet(), + self.SET_INSTALLED : syssets.InstalledSet(), + self.SET_UNINSTALLED : syssets.UninstalledSet(), + self.SET_TREE : syssets.TreeSet() } def get_update_option (self): @@ -56,9 +56,10 @@ class PortageSystem_22 (PortageSystem): s = self.setmap.get(pkgSet, None) if s is None: - return syssets.PortageSet(pkgSet) - else: - return s() + s = syssets.PortageSet(pkgSet) + self.setmap[pkgSet] = s + + return s def new_package (self, cpv): return PortagePackage_22(cpv) diff --git a/portato/backend/system_interface.py b/portato/backend/system_interface.py index 6f13042..5f4c50a 100644 --- a/portato/backend/system_interface.py +++ b/portato/backend/system_interface.py @@ -3,7 +3,7 @@ # File: portato/backend/system_interface.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2007-2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/config_parser.py b/portato/config_parser.py index 58e4038..cbf993f 100644 --- a/portato/config_parser.py +++ b/portato/config_parser.py @@ -3,7 +3,7 @@ # File: portato/config_parser.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2007 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/constants.py b/portato/constants.py index 3d7217f..3ab5a80 100644 --- a/portato/constants.py +++ b/portato/constants.py @@ -3,7 +3,7 @@ # File: portato/constants.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2007 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/db/__init__.py b/portato/db/__init__.py index e0919dd..05dbfcf 100644 --- a/portato/db/__init__.py +++ b/portato/db/__init__.py @@ -3,7 +3,7 @@ # File: portato/db/__init__.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2009 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/db/database.py b/portato/db/database.py index bc78b01..7a23e5e 100644 --- a/portato/db/database.py +++ b/portato/db/database.py @@ -3,7 +3,7 @@ # File: portato/db/database.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2009 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/db/dict.py b/portato/db/dict.py index d7e2649..f6edea6 100644 --- a/portato/db/dict.py +++ b/portato/db/dict.py @@ -3,7 +3,7 @@ # File: portato/db/dict.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2009 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/db/sql.py b/portato/db/sql.py index b46374e..ca01fd0 100644 --- a/portato/db/sql.py +++ b/portato/db/sql.py @@ -3,7 +3,7 @@ # File: portato/db/sql.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2009 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/dependency.py b/portato/dependency.py index 9a8ff37..bda20eb 100644 --- a/portato/dependency.py +++ b/portato/dependency.py @@ -3,7 +3,7 @@ # File: portato/dependency.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/gui/dialogs.py b/portato/gui/dialogs.py index 8931535..d7ac41b 100644 --- a/portato/gui/dialogs.py +++ b/portato/gui/dialogs.py @@ -11,7 +11,7 @@ # Written by René 'Necoro' Neumann <necoro@necoro.net> import gtk -from ..helper import error +from ..helper import error, get_runsystem def mail_failure_dialog(e): dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, _("Mail could not be sent")) @@ -109,7 +109,12 @@ def file_chooser_dialog (title, parent): def prereq_error_dialog (e): dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, _("A prerequisite for starting Portato was not matched.")) - dialog.format_secondary_text(e.message) + + msg = e.message + if get_runsystem()[0] == "Sabayon": + msg += "\n\n"+_("<b>Note</b>: On fresh Sabayon installs or its LiveDVD/-CD, there is no portage tree existing per default.\nPlease run <i>emerge --sync && layman -S</i>.") + + dialog.format_secondary_markup(msg) ret = dialog.run() dialog.destroy() return ret diff --git a/portato/gui/exception_handling.py b/portato/gui/exception_handling.py index a5174f5..2e9c76c 100644 --- a/portato/gui/exception_handling.py +++ b/portato/gui/exception_handling.py @@ -3,7 +3,7 @@ # File: portato/gui/exception_handling.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2007-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. @@ -18,7 +18,7 @@ import sys, traceback, os from StringIO import StringIO -from ..helper import debug, error +from ..helper import debug, error, get_runsystem from .dialogs import file_chooser_dialog, io_ex_dialog from .windows.mailinfo import MailInfoWindow from .utils import GtkThread @@ -101,20 +101,9 @@ def get_version_infos(): from ..constants import VERSION from ..backend import system - runsystem="Unknown" - if os.path.exists("/etc/gentoo-release"): - runsystem = "Gentoo" - else: - for sp in ("/etc/sabayon-release", "/etc/sabayon-edition"): - if os.path.exists(sp): - with open(sp) as r: - runsystem = "Sabayon: %s" % r.readline().strip() - break - - return "\n".join(( "Portato version: %s" % VERSION, - "System: %s" % runsystem, + "System: %s" % " ".join(get_runsystem()), "Python version: %s" % sys.version, "Used backend: %s" % system.get_version(), "pygtk: %s (using GTK+: %s)" % (convert(gtk.pygtk_version), convert(gtk.gtk_version)), diff --git a/portato/gui/exceptions.py b/portato/gui/exceptions.py index 11bc83d..17041dc 100644 --- a/portato/gui/exceptions.py +++ b/portato/gui/exceptions.py @@ -3,7 +3,7 @@ # File: portato/gui/exceptions.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2009 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/gui/queue.py b/portato/gui/queue.py index 5a414a2..d7b1e3f 100644 --- a/portato/gui/queue.py +++ b/portato/gui/queue.py @@ -3,7 +3,7 @@ # File: portato/gui/queue.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. @@ -22,7 +22,7 @@ from subprocess import Popen from .. import backend, plugin from ..backend import flags, system from ..backend.exceptions import BlockedException -from ..helper import debug, info, warning, send_signal_to_group, unique_array, flatten +from ..helper import debug, info, warning, error, send_signal_to_group, unique_array, flatten from ..waiting_queue import WaitingQueue from ..odict import OrderedDict from .updater import Updater @@ -191,14 +191,14 @@ class EmergeQueue: self.remove(top) raise - # add iter - subIt = self.tree.append(it, self.tree.build_append_value(cpv, oneshot = oneshot, update = update, downgrade = downgrade, version = uVersion, useChange = changedUse)) - self.iters[type][cpv] = subIt - # get dependencies deps = pkg.get_dep_packages(return_blocks = True) self.deps[type][cpv] = deps + # add iter + subIt = self.tree.append(it, self.tree.build_append_value(cpv, oneshot = oneshot, update = update, downgrade = downgrade, version = uVersion, useChange = changedUse)) + self.iters[type][cpv] = subIt + for d in deps: if d[0] == "!": # block dep = d[1:] @@ -300,9 +300,10 @@ class EmergeQueue: raise BlockedException(blocked, pkgs[0].get_cpv()) else: # unmerge - self.unmergequeue.append(cpv) - if self.tree: # update tree - self.iters["uninstall"][cpv] = self.tree.append(self.tree.get_unmerge_it(), self.tree.build_append_value(cpv)) + if cpv not in self.unmergequeue: + self.unmergequeue.append(cpv) + if self.tree: # update tree + self.iters["uninstall"][cpv] = self.tree.append(self.tree.get_unmerge_it(), self.tree.build_append_value(cpv)) def _queue_append (self, cpv, oneshot = False): """Convenience function appending a cpv either to self.mergequeue or to self.oneshotmerge. diff --git a/portato/gui/session.py b/portato/gui/session.py index 40a84f1..7aa890d 100644 --- a/portato/gui/session.py +++ b/portato/gui/session.py @@ -3,7 +3,7 @@ # File: portato/gui/session.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/gui/updater.py b/portato/gui/updater.py index c4ad2a5..7ce7c51 100644 --- a/portato/gui/updater.py +++ b/portato/gui/updater.py @@ -3,7 +3,7 @@ # File: portato/gui/updater.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/gui/utils.py b/portato/gui/utils.py index c9eae69..1ebefe8 100644 --- a/portato/gui/utils.py +++ b/portato/gui/utils.py @@ -3,7 +3,7 @@ # File: portato/gui/utils.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/gui/views.py b/portato/gui/views.py index 26a8a89..3fc965f 100644 --- a/portato/gui/views.py +++ b/portato/gui/views.py @@ -3,7 +3,7 @@ # File: portato/gui/views.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. @@ -18,6 +18,7 @@ import gtksourceview2 import logging from ..helper import warning +from ..log import add_handler class LazyView (object): def __init__ (self): @@ -147,7 +148,7 @@ class LogView (logging.Handler): for lvl, name, color in self.colors: self.buf.create_tag("log_%s" % name, foreground = color,weight = pango.WEIGHT_BOLD) - logging.getLogger("portatoLogger.stream").addHandler(self) + add_handler(self) def emit (self, record): diff --git a/portato/gui/windows/__init__.py b/portato/gui/windows/__init__.py index 394e84e..6a4ac82 100644 --- a/portato/gui/windows/__init__.py +++ b/portato/gui/windows/__init__.py @@ -3,7 +3,7 @@ # File: portato/gui/gtk/__init__.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/gui/windows/about.py b/portato/gui/windows/about.py index 21608c0..937ed8b 100644 --- a/portato/gui/windows/about.py +++ b/portato/gui/windows/about.py @@ -3,7 +3,7 @@ # File: portato/gui/windows/about.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/gui/windows/basic.py b/portato/gui/windows/basic.py index 635083a..1117e5e 100644 --- a/portato/gui/windows/basic.py +++ b/portato/gui/windows/basic.py @@ -3,7 +3,7 @@ # File: portato/gui/windows/basic.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. @@ -20,7 +20,7 @@ import gobject from functools import wraps import os.path -from ...constants import TEMPLATE_DIR, APP_ICON, APP, LOCALE_DIR +from ...constants import TEMPLATE_DIR, APP, LOCALE_DIR from ...helper import error gtk.glade.bindtextdomain (APP, LOCALE_DIR) @@ -59,7 +59,6 @@ class Window (object): self.tree = self.get_tree(self.__tree__) self.tree.signal_autoconnect(self) self.window = self.tree.get_widget(self.__window__) - self.window.set_icon_from_file(APP_ICON) @staticmethod def watch_cursor (func): diff --git a/portato/gui/windows/mailinfo.py b/portato/gui/windows/mailinfo.py index bbcbf1f..0cc79f2 100644 --- a/portato/gui/windows/mailinfo.py +++ b/portato/gui/windows/mailinfo.py @@ -3,7 +3,7 @@ # File: portato/gui/windows/mailinfo.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py index 9f3c123..8d5e5ae 100644 --- a/portato/gui/windows/main.py +++ b/portato/gui/windows/main.py @@ -164,7 +164,7 @@ class PackageTable: self.linkBox.remove(c) text = pkg.get_package_settings("HOMEPAGE") - texts = text.split(" ") + texts = text.split() ftexts = [] for count, t in enumerate(texts): @@ -440,6 +440,10 @@ class MainWindow (Window): self.window.set_title(self.main_title) self.window.set_geometry_hints (self.window, max_height = gtk.gdk.screen_height(), max_width = gtk.gdk.screen_width()) + # app icon + self.window.set_icon_from_file(APP_ICON) + gtk.window_set_default_icon(self.window.get_icon()) + # booleans self.doUpdate = False self.showAll = True # show only installed or all packages? @@ -1049,73 +1053,19 @@ class MainWindow (Window): # SELECTION def load_pkg_selection (name): pos = "0" - col = 1 - model = self.pkgList.get_model() - - if name: - if oldVersion > 1: # newer one - name, pos = name.split("@") - - if model[pos][col] != name: # need to search :( - debug("Pkg path does not match. Searching...") - for cname, path in ((x[col], x.path) for x in model): - if cname == name: - pos = path - break + if name and oldVersion > 1: # newer one + name, pos = name.split("@") - debug("Selecting pkg path '%s'. Value: '%s'", pos, model[pos][col]) - self.pkgList.get_selection().select_path(pos) - self.pkgList.scroll_to_cell(pos) + self.jump_to_pkg(name, pos) def load_cat_selection (name): pos = "0" - col = 0 - model = self.catList.get_model() - - if name: - if oldVersion > 1: # newer one - name, pos = name.split("@") - - if self.cfg.get_boolean("collapseCats", "GUI"): - try: - sname = name.split("-", 1) - except ValueError: # nothing to split - sname = None - else: - sname = None - - if sname is None and model[pos][col] != name: # need to search in normal list - debug("Cat path does not match. Searching...") - for cname, path in ((x[col], x.path) for x in model): - if cname == name: - pos = path - break - - elif sname: # the collapse case - row = model[pos.split(":")[0]] - no_match = False - if row[col] != sname[0]: # first part does not match :( - debug("First part of cat path does not match. Searching...") - no_match = True - for r in model: - if r[col] == sname[0]: - row = r - break - - if no_match or model[pos][col] != sname[1]: - debug("Second part of cat path does not match. Searching...") - for cname, path in ((x[col], x.path) for x in row.iterchildren()): - if cname == sname[1]: # found second - pos = ":".join(map(str,path)) - break - - self.catList.expand_to_path(pos) + if name and oldVersion > 1: # newer one + name, pos = name.split("@") - debug("Selecting cat path '%s'. Value: '%s'", pos, model[pos][col]) - self.catList.get_selection().select_path(pos) - self.catList.scroll_to_cell(pos) + self.jump_to_cat(name, pos) def save_pkg_selection (): store, iter = self.pkgList.get_selection().get_selected() @@ -1235,17 +1185,76 @@ class MainWindow (Window): cat, pkg = cp.split("/") - for list, idx, what, expr in ((self.catList, 0, "categories", cat), (self.pkgList, 1, "packages", pkg)): - pathes = [row.path for row in list.get_model() if row[idx] == expr] + self.jump_to_cat(cat) + self.jump_to_pkg(pkg) + + self.show_package(cp = cp, version = version, queue = self.queue) + + def jump_to_pkg (self, name = None, pos = "0"): + if isinstance(pos, int): + pos = str(pos) + + col = 1 + model = self.pkgList.get_model() + + if name: + if model[pos][col] != name: # need to search :( + debug("Pkg path does not match. Searching...") + for cname, path in ((x[col], x.path) for x in model): + if cname == name: + pos = path + break + + debug("Selecting pkg path '%s'. Value: '%s'", pos, model[pos][col]) + self.pkgList.get_selection().select_path(pos) + self.pkgList.scroll_to_cell(pos) - if len(pathes) == 1: - list.get_selection().select_path(pathes[0]) - list.scroll_to_cell(pathes[0]) + def jump_to_cat (self, name = None, pos = "0"): + if isinstance(pos, int): + pos = str(pos) + + col = 0 + model = self.catList.get_model() + + if name: + if self.cfg.get_boolean("collapseCats", "GUI"): + try: + sname = name.split("-", 1) + except ValueError: # nothing to split + sname = None else: - debug("Unexpected number of %s returned after search: %d", what, len(pathes)) - break + sname = None + + if sname is None and model[pos][col] != name: # need to search in normal list + debug("Cat path does not match. Searching...") + for cname, path in ((x[col], x.path) for x in model): + if cname == name: + pos = path + break + + elif sname: # the collapse case + row = model[pos.split(":")[0]] + no_match = False + if row[col] != sname[0]: # first part does not match :( + debug("First part of cat path does not match. Searching...") + no_match = True + for r in model: + if r[col] == sname[0]: + row = r + break - self.show_package(cp = cp, version = version, queue = self.queue) + if no_match or model[pos][col] != sname[1]: + debug("Second part of cat path does not match. Searching...") + for cname, path in ((x[col], x.path) for x in row.iterchildren()): + if cname == sname[1]: # found second + pos = ":".join(map(str,path)) + break + + self.catList.expand_to_path(pos) + + debug("Selecting cat path '%s'. Value: '%s'", pos, model[pos][col]) + self.catList.get_selection().select_path(pos) + self.catList.scroll_to_cell(pos) def set_uri_hook (self, browser): """ @@ -1624,9 +1633,6 @@ class MainWindow (Window): """Do a search.""" text = entry.get_text() if text != "": - if "/" not in text: - text = "/.*"+text # only look for package names - packages = system.find_packages(text, with_version = False) if packages == []: diff --git a/portato/gui/windows/plugin.py b/portato/gui/windows/plugin.py index eccf302..755ad58 100644 --- a/portato/gui/windows/plugin.py +++ b/portato/gui/windows/plugin.py @@ -3,7 +3,7 @@ # File: portato/gui/windows/plugin.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/gui/windows/preference.py b/portato/gui/windows/preference.py index 87a1860..df18e88 100644 --- a/portato/gui/windows/preference.py +++ b/portato/gui/windows/preference.py @@ -3,7 +3,7 @@ # File: portato/gui/windows/preference.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/gui/windows/search.py b/portato/gui/windows/search.py index 415cbfe..c531507 100644 --- a/portato/gui/windows/search.py +++ b/portato/gui/windows/search.py @@ -3,7 +3,7 @@ # File: portato/gui/windows/search.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/gui/windows/splash.py b/portato/gui/windows/splash.py index c27f74f..39ba00d 100644 --- a/portato/gui/windows/splash.py +++ b/portato/gui/windows/splash.py @@ -3,7 +3,7 @@ # File: portato/gui/windows/splash.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2007-2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/gui/windows/update.py b/portato/gui/windows/update.py index 297f666..8e32dd9 100644 --- a/portato/gui/windows/update.py +++ b/portato/gui/windows/update.py @@ -3,7 +3,7 @@ # File: portato/gui/windows/update.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/gui/wrapper.py b/portato/gui/wrapper.py index a160e2f..525ad12 100644 --- a/portato/gui/wrapper.py +++ b/portato/gui/wrapper.py @@ -3,7 +3,7 @@ # File: portato/gui/wrapper.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/helper.py b/portato/helper.py index 8a312c0..d3fc70b 100644 --- a/portato/helper.py +++ b/portato/helper.py @@ -3,7 +3,7 @@ # File: portato/helper.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2007 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. @@ -13,22 +13,21 @@ """ Some nice functions used in the program. """ -from __future__ import absolute_import +from __future__ import absolute_import, with_statement import os, signal, logging, grp -debug = logging.getLogger("portatoLogger.stream").debug -info = logging.getLogger("portatoLogger.stream").info -warning = logging.getLogger("portatoLogger.stream").warning -error = logging.getLogger("portatoLogger.stream").error -critical = logging.getLogger("portatoLogger.stream").critical +from .log import set_log_level + +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 def N_ (s): return s -def set_log_level (lvl): - logging.getLogger("portatoLogger.stream").setLevel(lvl) - def send_signal_to_group (sig): """Sends a signal to all processes of our process group (w/o ourselves). @@ -44,6 +43,18 @@ def send_signal_to_group (sig): pgid = os.getpgrp() os.killpg(pgid, sig) +def get_runsystem (): + # check for sabayon first, as sabayon also has the gentoo release + for sp in ("/etc/sabayon-release", "/etc/sabayon-edition"): + if os.path.exists(sp): + with open(sp) as r: + return ("Sabayon", r.readline().strip()) + + if os.path.exists("/etc/gentoo-release"): + return ("Gentoo", "") + + else: return ("Unknown", "") + def paren_reduce(mystr): """ Take a string and convert all paren enclosed entities into sublists, optionally diff --git a/portato/log.py b/portato/log.py index 97b1493..486aa51 100644 --- a/portato/log.py +++ b/portato/log.py @@ -3,7 +3,7 @@ # File: portato/log.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. @@ -21,6 +21,11 @@ from .constants import SESSION_DIR (S_NOT, S_STREAM_ONLY, S_BOTH) = range(3) started = S_NOT +streamhandlers = [] # the handler printing visibile to the user + +def add_handler (h): + logging.getLogger("portatoLogger").addHandler(h) + streamhandlers.append(h) LOGFILE = os.path.join(SESSION_DIR, "portato.log") @@ -42,7 +47,7 @@ class OutputFormatter (logging.Formatter): if hasattr(sys.stderr, "fileno"): self.istty = os.isatty(sys.stderr.fileno()) else: - self.istty = False # no fileno -> save default + self.istty = False # no fileno -> safe default def format (self, record): string = logging.Formatter.format(self, record) @@ -67,7 +72,7 @@ def start(file = True): if started == S_BOTH: return - # logging: root (file) + # logging: file if file: if not (os.path.exists(SESSION_DIR) and os.path.isdir(SESSION_DIR)): os.mkdir(SESSION_DIR) @@ -87,7 +92,11 @@ def start(file = True): formatter = OutputFormatter("%(message)s (%(filename)s:%(lineno)s)") handler = logging.StreamHandler() handler.setFormatter(formatter) - logging.getLogger("portatoLogger.stream").addHandler(handler) - logging.getLogger("portatoLogger.stream").setLevel(logging.DEBUG) + add_handler(handler) started = S_BOTH if file else S_STREAM_ONLY + + +def set_log_level (lvl): + for h in streamhandlers: + h.setLevel(lvl) diff --git a/portato/plistener.py b/portato/plistener.py index f842758..349cf03 100644 --- a/portato/plistener.py +++ b/portato/plistener.py @@ -3,7 +3,7 @@ # File: portato/plistener.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2007-2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/plugin.py b/portato/plugin.py index fb2e8f4..94a0b4c 100644 --- a/portato/plugin.py +++ b/portato/plugin.py @@ -3,7 +3,7 @@ # File: portato/plugin.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/plugins/__init__.py b/portato/plugins/__init__.py index 5080cec..22d98be 100644 --- a/portato/plugins/__init__.py +++ b/portato/plugins/__init__.py @@ -3,7 +3,7 @@ # File: portato/plugins/__init__.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2007-2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/session.py b/portato/session.py index 76e5540..667771a 100644 --- a/portato/session.py +++ b/portato/session.py @@ -3,7 +3,7 @@ # File: portato/session.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2007-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. diff --git a/portato/waiting_queue.py b/portato/waiting_queue.py index bc2c50c..d946abe 100644 --- a/portato/waiting_queue.py +++ b/portato/waiting_queue.py @@ -3,7 +3,7 @@ # File: portato/waiting_queue.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2007 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. @@ -4,7 +4,7 @@ # File: setup.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2008 René 'Necoro' Neumann +# Copyright (C) 2006-2009 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. |