summaryrefslogtreecommitdiff
path: root/portato
diff options
context:
space:
mode:
Diffstat (limited to 'portato')
-rw-r--r--portato/__init__.py8
-rw-r--r--portato/backend/__init__.py61
-rw-r--r--portato/backend/exceptions.py2
-rw-r--r--portato/backend/flags.py2
-rw-r--r--portato/backend/package.py12
-rw-r--r--portato/backend/portage/__init__.py2
-rw-r--r--portato/backend/portage/package.py16
-rw-r--r--portato/backend/portage/package_22.py2
-rw-r--r--portato/backend/portage/sets.py4
-rw-r--r--portato/backend/portage/settings.py2
-rw-r--r--portato/backend/portage/settings_22.py2
-rw-r--r--portato/backend/portage/system.py32
-rw-r--r--portato/backend/portage/system_22.py10
-rw-r--r--portato/backend/system_interface.py20
-rw-r--r--portato/config_parser.py2
-rw-r--r--portato/constants.py9
-rw-r--r--portato/db/__init__.py4
-rw-r--r--portato/db/database.py35
-rw-r--r--portato/db/eix_sql.py9
-rw-r--r--portato/db/hash.py5
-rw-r--r--portato/db/sql.py28
-rw-r--r--portato/dependency.py2
-rw-r--r--portato/eix/__init__.py2
-rw-r--r--portato/eix/exceptions.py2
-rw-r--r--portato/eix/parser.pyx6
-rw-r--r--portato/eix/py_parser.py2
-rw-r--r--portato/gui/__init__.py8
-rw-r--r--portato/gui/dialogs.py4
-rw-r--r--portato/gui/exception_handling.py7
-rw-r--r--portato/gui/exceptions.py2
-rw-r--r--portato/gui/queue.py4
-rw-r--r--portato/gui/session.py2
-rw-r--r--portato/gui/slots.py2
-rw-r--r--portato/gui/templates/AboutWindow.ui36
-rw-r--r--portato/gui/templates/MainWindow.menu16
-rw-r--r--portato/gui/templates/MainWindow.ui18
-rw-r--r--portato/gui/templates/PkgListWindow.ui (renamed from portato/gui/templates/UpdateWindow.ui)19
-rw-r--r--portato/gui/templates/PreferenceWindow.ui2
-rw-r--r--portato/gui/updater.py2
-rw-r--r--portato/gui/utils.py9
-rw-r--r--portato/gui/views.py2
-rw-r--r--portato/gui/windows/__init__.py2
-rw-r--r--portato/gui/windows/about.py10
-rw-r--r--portato/gui/windows/basic.py3
-rw-r--r--portato/gui/windows/mailinfo.py2
-rw-r--r--portato/gui/windows/main.py98
-rw-r--r--portato/gui/windows/pkglist.py (renamed from portato/gui/windows/update.py)71
-rw-r--r--portato/gui/windows/plugin.py2
-rw-r--r--portato/gui/windows/preference.py2
-rw-r--r--portato/gui/windows/search.py2
-rw-r--r--portato/gui/windows/splash.py7
-rw-r--r--portato/helper.py2
-rw-r--r--portato/ipc.pxd2
-rw-r--r--portato/ipc.pyx2
-rw-r--r--portato/listener.py2
-rw-r--r--portato/log.py12
-rw-r--r--portato/plugin.py2
-rw-r--r--portato/plugins/__init__.py2
-rw-r--r--portato/session.py4
-rw-r--r--portato/su.py2
-rw-r--r--portato/waiting_queue.py2
61 files changed, 450 insertions, 195 deletions
diff --git a/portato/__init__.py b/portato/__init__.py
index 44a4da4..61d6a42 100644
--- a/portato/__init__.py
+++ b/portato/__init__.py
@@ -3,7 +3,7 @@
# File: portato/__init__.py
# This file is part of the Portato-Project, a graphical portage-frontend.
#
-# Copyright (C) 2006-2009 René 'Necoro' Neumann
+# Copyright (C) 2006-2010 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.
@@ -17,9 +17,13 @@ import sys, os
from optparse import OptionParser, SUPPRESS_HELP
from .log import start as logstart
-from .constants import LOCALE_DIR, APP, VERSION
+from .constants import LOCALE_DIR, APP, VERSION, REVISION
from .helper import debug, info, error
+# set better version info
+if REVISION:
+ VERSION = '%s (git: %s)' % (VERSION, REVISION)
+
# listener-handling
__listener = None
diff --git a/portato/backend/__init__.py b/portato/backend/__init__.py
index 8eae806..5f32818 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-2009 René 'Necoro' Neumann
+# Copyright (C) 2006-2010 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.
@@ -16,9 +16,6 @@ from ..helper import debug
from .system_interface import SystemInterface
from .exceptions import BlockedException, PackageNotFoundException, DependencyCalcError, InvalidSystemError
-SYSTEM = "portage" # the name of the current system
-_sys = None # the SystemInterface-instance
-
class _Package (object):
"""Wrapping class from which L{portato.backend.Package} inherits. This is used by the flags module to check
whether an object is a package. It cannot use the normal Package class as this results in cyclic dependencies."""
@@ -26,42 +23,48 @@ class _Package (object):
def __init__ (self):
raise TypeError, "Calling __init__ on portato.backend._Package objects is not allowed."
+def is_package(what):
+ return isinstance(what, _Package)
+
class SystemWrapper (SystemInterface):
"""This is a wrapper to the different system interfaces, allowing the direct import via C{from portato.backend import system}.
With this wrapper a change of the system is propagated to all imports."""
+ __system = 'portage'
+ __wrapped_sys = None
+ __slots__ = ('__system', '__wrapped_sys', 'set_system', '__load')
+
def __getattribute__ (self, name):
"""Just pass all attribute accesses directly to _sys."""
- return getattr(_sys, name)
-def set_system (new_sys):
- """Sets the current system to a new one.
+ if name in SystemWrapper.__slots__:
+ return object.__getattribute__(self, name)
+
+ if SystemWrapper.__wrapped_sys is None:
+ SystemWrapper.__load()
- @param new_sys: the name of the system to take
- @type new_sys: string"""
+ return getattr(SystemWrapper.__wrapped_sys, name)
- global SYSTEM
- if new_sys != SYSTEM:
- SYSTEM = new_sys
- load_system()
+ @classmethod
+ def set_system (cls, system):
+ """Sets the current system to a new one.
-def load_system ():
- """Loads the current chosen system.
+ @param system: the name of the system to take
+ @type system: string"""
- @raises InvalidSystemError: if an inappropriate system is set"""
-
- global _sys
+ cls.__system = system
+ cls.__wrapped_sys = None
- if SYSTEM == "portage":
- debug("Setting Portage System")
- from .portage import PortageSystem
- _sys = PortageSystem ()
- else:
- raise InvalidSystemError, SYSTEM
+ @classmethod
+ def __load (cls):
+ """Loads the current chosen system.
-system = SystemWrapper()
+ @raises InvalidSystemError: if an inappropriate system is set"""
+ if cls.__system == "portage":
+ debug("Setting Portage System")
+ from .portage import PortageSystem
+ cls.__wrapped_sys = PortageSystem ()
+ else:
+ raise InvalidSystemError, cls.__system
-def is_package(what):
- return isinstance(what, _Package)
-
-load_system()
+system = SystemWrapper()
diff --git a/portato/backend/exceptions.py b/portato/backend/exceptions.py
index f20a33e..dc2c7cd 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-2009 René 'Necoro' Neumann
+# Copyright (C) 2006-2010 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 9c5b93d..810b607 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-2009 René 'Necoro' Neumann
+# Copyright (C) 2006-2010 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/package.py b/portato/backend/package.py
index 8a80fd5..34cdbe4 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-2009 René 'Necoro' Neumann
+# Copyright (C) 2006-2010 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.
@@ -371,16 +371,6 @@ class Package (_Package):
raise NotImplementedError
- def compare_version(self, other):
- """Compares this package's version to another's CPV; returns -1, 0, 1.
-
- @param other: the other package
- @type other: Package
- @returns: -1, 0 or 1
- @rtype: int"""
-
- raise NotImplementedError
-
def matches (self, criterion):
"""This checks, whether this package matches a specific versioning criterion - e.g.: "<=net-im/foobar-1.2".
diff --git a/portato/backend/portage/__init__.py b/portato/backend/portage/__init__.py
index 1daf51b..e559f9e 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-2009 René 'Necoro' Neumann
+# Copyright (C) 2006-2010 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 2b40e41..b34e3ef 100644
--- a/portato/backend/portage/package.py
+++ b/portato/backend/portage/package.py
@@ -3,7 +3,7 @@
# File: portato/backend/portage/package.py
# This file is part of the Portato-Project, a graphical portage-frontend.
#
-# Copyright (C) 2006-2009 René 'Necoro' Neumann
+# Copyright (C) 2006-2010 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.
@@ -294,18 +294,8 @@ class PortagePackage (Package):
return self.get_package_settings("USE", installed = True).split()
else: return []
- def compare_version(self,other):
- v1 = self._scpv
- v2 = portage.catpkgsplit(other.get_cpv())
- # if category is different
- if v1[0] != v2[0]:
- return cmp(v1[0],v2[0])
- # if name is different
- elif v1[1] != v2[1]:
- return cmp(v1[1],v2[1])
- # Compare versions
- else:
- return portage.pkgcmp(v1[1:],v2[1:])
+ def __cmp__ (self, other):
+ return system.compare_versions(self.get_cpv(), other.get_cpv())
def matches (self, criterion):
# cpv_matches needs explicit slot info
diff --git a/portato/backend/portage/package_22.py b/portato/backend/portage/package_22.py
index ed804ce..23e8ed5 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) 2006-2009 René 'Necoro' Neumann
+# Copyright (C) 2006-2010 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 234047b..c1971b7 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) 2006-2009 René 'Necoro' Neumann
+# Copyright (C) 2006-2010 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.
@@ -102,7 +102,7 @@ class InstalledSet (Set):
else:
t = system.settings.vartree.dbapi.match(key)
if not with_version:
- t = itt.imap(portage.dep.dep_getkey, t)
+ t = itt.imap(portage.cpv_getkey, t)
return set(t)
diff --git a/portato/backend/portage/settings.py b/portato/backend/portage/settings.py
index 8211f3b..2f3b780 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-2009 René 'Necoro' Neumann
+# Copyright (C) 2006-2010 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 bae3424..ba4f1e8 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) 2006-2009 René 'Necoro' Neumann
+# Copyright (C) 2006-2010 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 d7c7806..3aaa060 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-2009 René 'Necoro' Neumann
+# Copyright (C) 2006-2010 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.
@@ -68,7 +68,12 @@ class PortageSystem (SystemInterface):
return PortagePackage(cpv)
def get_config_path (self):
- return portage.USER_CONFIG_PATH
+ path = portage.USER_CONFIG_PATH
+
+ if path[0] != "/":
+ return os.path.join(self.settings.settings["ROOT"], path)
+ else:
+ return path
def get_merge_command (self):
return ["/usr/bin/python", "/usr/bin/emerge"]
@@ -120,6 +125,20 @@ class PortageSystem (SystemInterface):
else:
return True
+ def compare_versions(self, v1, v2):
+ v1 = self.split_cpv(v1)
+ v2 = self.split_cpv(v2)
+
+ # if category is different
+ if v1[0] != v2[0]:
+ return cmp(v1[0],v2[0])
+ # if name is different
+ elif v1[1] != v2[1]:
+ return cmp(v1[1],v2[1])
+ # Compare versions
+ else:
+ return portage.pkgcmp(v1[1:],v2[1:])
+
def with_bdeps(self):
"""Returns whether the "--with-bdeps" option is set to true.
@@ -218,8 +237,11 @@ class PortageSystem (SystemInterface):
cpv = portage.dep_getcpv(cpv)
return portage.catpkgsplit(cpv)
- def sort_package_list(self, pkglist):
- pkglist.sort(PortagePackage.compare_version) # XXX: waaah ... direct package naming... =/
+ def sort_package_list(self, pkglist, only_cpv = False):
+ if only_cpv:
+ pkglist.sort(self.compare_versions)
+ else:
+ pkglist.sort()
return pkglist
def reload_settings (self):
@@ -240,7 +262,7 @@ class PortageSystem (SystemInterface):
if not best:
return
- if not best.is_installed() and (best.is_masked() or best.is_testing(True)): # check to not update unnecessairily
+ if not best.is_installed() and (best.is_masked() or best.is_testing(True)): # check to not update unnecessarily
for i in inst:
if i.matches(crit):
debug("The installed %s matches %s. Discarding upgrade to masked version %s.", i.get_cpv(), crit, best.get_version())
diff --git a/portato/backend/portage/system_22.py b/portato/backend/portage/system_22.py
index f69e15c..c3bfa5f 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) 2006-2009 René 'Necoro' Neumann
+# Copyright (C) 2006-2010 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.
@@ -63,11 +63,3 @@ 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 be79de2..a156d2b 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) 2006-2009 René 'Necoro' Neumann
+# Copyright (C) 2006-2010 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.
@@ -68,6 +68,18 @@ class SystemInterface (object):
"""
raise NotImplementedError
+
+ def compare_versions(self, v1, v2):
+ """Compares two CPVs; returns -1, 0, 1.
+
+ @param v1: one CPV
+ @type v1: cpv
+ @param v2: the second CPV
+ @type v2: cpv
+ @returns: -1, 0 or 1
+ @rtype: int"""
+
+ raise NotImplementedError
def find_best(self, list, only_cpv = False):
"""Returns the best package out of a list of packages.
@@ -134,11 +146,13 @@ class SystemInterface (object):
raise NotImplementedError
- def sort_package_list(self, pkglist):
+ def sort_package_list(self, pkglist, only_cpv = False):
"""Sorts a package list in the same manner portage does.
@param pkglist: list to sort
- @type pkglist: Packages[]
+ @type pkglist: Packages[] or cpv[]
+ @param only_cpv: flags whether the passed list consists of Packages or of CPVs
+ @type: bool
"""
raise NotImplementedError
diff --git a/portato/config_parser.py b/portato/config_parser.py
index 39234a9..2ef52c5 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-2009 René 'Necoro' Neumann
+# Copyright (C) 2006-2010 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 7d2a9d6..a8e930c 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-2009 René 'Necoro' Neumann
+# Copyright (C) 2006-2010 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.
@@ -42,8 +42,10 @@ These should be set during the installation.
@var TEMPLATE_DIR: Directory containing the UI template files.
@type TEMPLATE_DIR: string
-@var REPOURI: the URI of the bzr repository -- only used in live versions
+@var REPOURI: the URI of the git repository -- only used in live versions
@type REPOURI: string
+@var REVISION: the revision of the live version
+@type REVISION: string
"""
import os
from os.path import join as pjoin
@@ -70,4 +72,5 @@ SETTINGS_DIR = pjoin(HOME, "."+APP)
TEMPLATE_DIR = "portato/gui/templates/"
# live versions only
-REPOURI = "lp:portato"
+REPOURI = "git://github.com/Necoro/portato.git::master"
+REVISION = ""
diff --git a/portato/db/__init__.py b/portato/db/__init__.py
index 9d21d3b..21f72ce 100644
--- a/portato/db/__init__.py
+++ b/