summaryrefslogtreecommitdiff
path: root/portato
diff options
context:
space:
mode:
Diffstat (limited to 'portato')
-rw-r--r--portato/__init__.py2
-rw-r--r--portato/backend/__init__.py2
-rw-r--r--portato/backend/exceptions.py2
-rw-r--r--portato/backend/flags.py2
-rw-r--r--portato/backend/package.py2
-rw-r--r--portato/backend/portage/__init__.py2
-rw-r--r--portato/backend/portage/package.py2
-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.py4
-rw-r--r--portato/backend/portage/system_22.py2
-rw-r--r--portato/backend/system_interface.py2
-rw-r--r--portato/config_parser.py2
-rw-r--r--portato/constants.py2
-rw-r--r--portato/db/__init__.py98
-rw-r--r--portato/db/database.py37
-rw-r--r--portato/db/eix_sql.py9
-rw-r--r--portato/db/exceptions.py24
-rw-r--r--portato/db/hash.py5
-rw-r--r--portato/db/sql.py32
-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__.py2
-rw-r--r--portato/gui/dialogs.py22
-rw-r--r--portato/gui/exception_handling.py6
-rw-r--r--portato/gui/exceptions.py2
-rw-r--r--portato/gui/queue.py2
-rw-r--r--portato/gui/session.py2
-rw-r--r--portato/gui/slots.py2
-rw-r--r--portato/gui/templates/AboutWindow.ui8
-rw-r--r--portato/gui/templates/MailInfoWindow.ui38
-rw-r--r--portato/gui/templates/MainWindow.menu7
-rw-r--r--portato/gui/templates/MainWindow.ui18
-rw-r--r--portato/gui/templates/PreferenceWindow.ui2
-rw-r--r--portato/gui/updater.py2
-rw-r--r--portato/gui/utils.py2
-rw-r--r--portato/gui/views.py2
-rw-r--r--portato/gui/windows/__init__.py2
-rw-r--r--portato/gui/windows/about.py15
-rw-r--r--portato/gui/windows/basic.py5
-rw-r--r--portato/gui/windows/mailinfo.py139
-rw-r--r--portato/gui/windows/main.py86
-rw-r--r--portato/gui/windows/pkglist.py2
-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.py2
-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.py134
-rw-r--r--portato/su.py2
-rw-r--r--portato/waiting_queue.py2
62 files changed, 527 insertions, 264 deletions
diff --git a/portato/__init__.py b/portato/__init__.py
index 98c019d..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.
diff --git a/portato/backend/__init__.py b/portato/backend/__init__.py
index 4f20a18..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.
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 89d1528..56b910d 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.
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 f108bde..7dbefb7 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.
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 4a08616..34d2b5c 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.
@@ -249,7 +249,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 d720a06..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.
diff --git a/portato/backend/system_interface.py b/portato/backend/system_interface.py
index f0bfdf6..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.
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 bce15d2..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.
diff --git a/portato/db/__init__.py b/portato/db/__init__.py
index 9d21d3b..850a84e 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) 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.
@@ -12,66 +12,66 @@
from __future__ import absolute_import
+from . import database as db
+from .exceptions import UnknownDatabaseTypeError, DatabaseInstantiationError
from ..session import Session, SectionDict
from ..helper import debug, warning, error
-class UnknownDatabaseTypeError (Exception):
- pass
-
-_SESSION = None
-_TYPE = None
-_DEFAULT = "dict"
-_DATABASE = None
-
types = {
"sql": (_("SQLite"), _("Uses an SQLite-database to store package information.\nMay take longer to generate at the first time, but has advantages if portato is re-started with an unchanged portage tree. Additionally it allows to use fast SQL expressions for fetching the data.")),
"dict": (_("Hashmap"), _("Uses an in-memory hashmap to store package information.\nHas been used since at least version 0.3.3, but all information has to be regenerated on each startup.")),
- "eixsql" : (_("eix + SQLite"), _("Similar to SQLite, but now uses the eix database to get the package information.\nThis should be much faster on startup, but requires that your eix database is always up-to-date."))
+ "eixsql" : (_("eix + SQLite"), _("Similar to SQLite, but now uses the eix database to get the package information.\nThis should be much faster on startup, but requires that your eix database is always up-to-date.\nAdditionally, this is the only database allowing searching in descriptions."))
}
-def Database(type = None):
- global _SESSION, _TYPE, _DATABASE
+class Database(db.Database):
+ DEFAULT = "dict"
- if type is None:
- if _DATABASE is None:
- warning("No database type specified! Falling back to default.")
- return Database(_DEFAULT)
- else:
- return _DATABASE
+ def __new__ (cls, type = None):
+ if not '_the_instance' in cls.__dict__:
+ dbcls = cls._generate(type)
+ cls._the_instance = dbcls(cls._get_session())
+ elif type is not None:
+ raise DatabaseInstantiationError("Database instantiation called with 'type' argument multiple times.")
+ return cls._the_instance
- if _SESSION is None:
- _SESSION = Session("db.cfg", name = "DB")
- _SESSION.load()
+ @classmethod
+ def _generate(cls, type):
- _TYPE = type
+ if type is None:
+ warning("No database type specified! Falling back to default.")
+ type = cls.DEFAULT
+
+ cls.DB_TYPE = type
- if type == "sql":
- debug("Using SQLDatabase")
- try:
- from .sql import SQLDatabase
- except ImportError:
- warning(_("Cannot load %s."), "SQLDatabase")
- _DATABASE = Database("dict")
- else:
- _DATABASE = SQLDatabase(SectionDict(_SESSION, type))
+ if type == "sql":
+ debug("Using SQLDatabase")
+ try:
+ from .sql import SQLDatabase
+ except ImportError:
+ warning(_("Cannot load %s."), "SQLDatabase")
+ return cls._generate("dict")
+ else:
+ return SQLDatabase
- elif type == "dict":
- debug("Using HashDatabase")
- from .hash import HashDatabase
- _DATABASE = HashDatabase(SectionDict(_SESSION, type))
-
- elif type == "eixsql":
- debug("Using EixSQLDatabase")
- try:
- from .eix_sql import EixSQLDatabase
- except ImportError:
- warning(_("Cannot load %s."), "EixSQLDatabase.")
- _DATABASE = Database("sql")
- else:
- _DATABASE = EixSQLDatabase(SectionDict(_SESSION, type))
+ elif type == "dict":
+ debug("Using HashDatabase")
+ from .hash import HashDatabase
+ return HashDatabase
+
+ elif type == "eixsql":
+ debug("Using EixSQLDatabase")
+ try:
+ from .eix_sql import EixSQLDatabase
+ except ImportError:
+ warning(_("Cannot load %s."), "EixSQLDatabase.")
+ return cls._generate("sql")
+ else:
+ return EixSQLDatabase
- else:
- error(_("Unknown database type: %s"), type)
- raise UnknownDatabaseTypeError, type
+ else:
+ error(_("Unknown database type: %s"), type)
+ raise UnknownDatabaseTypeError, type
- return _DATABASE
+ @classmethod
+ def _get_session(cls):
+ return SectionDict(Session("db.cfg", name = "DB"), cls.DB_TYPE)
diff --git a/portato/db/database.py b/portato/db/database.py
index 7a23e5e..c679d06 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) 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.
@@ -14,6 +14,12 @@ from __future__ import absolute_import, with_statement
from threading import RLock
from functools import wraps
+from ..helper import warning
+
+from .exceptions import UnsupportedSearchTypeError
+
+class UnsupportedSearchTypeError(Exception):
+ pass
class PkgData (object):
__slots__ = ("cat", "pkg", "inst", "disabled")
@@ -37,8 +43,19 @@ class Database (object):
ALL = _("ALL")
+ SEARCH_NAME = 1
+ SEARCH_DESCRIPTION = 2
+
+ TYPES = {
+ SEARCH_NAME : _("Name"),
+ SEARCH_DESCRIPTION : _("Description"),
+ SEARCH_NAME | SEARCH_DESCRIPTION : "%s + %s" % (_("Name"), _("Description"))
+ }
+
+
def __init__ (self):
self._lock = RLock()
+ self.type = self.SEARCH_NAME
@staticmethod
def lock (f):
@@ -51,6 +68,24 @@ class Database (object):
return wrapper
+ def search_types (self):
+ """The types of search supported by the database.
+
+ @return: type
+ @rtype: int"""
+ raise NotImplentedError
+
+ def set_type (self, type):
+ if type & self.search_types() != type:
+ raise UnsupportedSearchTypeError, type
+
+ self._type = type
+
+ def get_type (self):
+ return self._type
+
+ type = property(get_type, set_type)
+
def populate (self, category = None):
"""Populates the database.
diff --git a/portato/db/eix_sql.py b/portato/db/eix_sql.py
index c2d2292..75bcb1e 100644
--- a/portato/db/eix_sql.py
+++ b/portato/db/eix_sql.py
@@ -3,7 +3,7 @@
# File: portato/db/eix_sql.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.
@@ -41,6 +41,9 @@ class EixSQLDatabase (SQLDatabase):
SQLDatabase.__init__(self, session)
+ def search_types(self):
+ return self.SEARCH_NAME | self.SEARCH_DESCRIPTION
+
def updated (self):
mtime = os.stat(self.cache).st_mtime
old = self.session.get("mtime", 0)
@@ -63,7 +66,7 @@ class EixSQLDatabase (SQLDatabase):
if category is None or cat.name == category:
for pkg in cat.packages:
p = "%s/%s" % (cat.name, pkg.name)
- yield (cat.name, pkg.name, p in inst, False)
+ yield (cat.name, pkg.name, pkg.description, p in inst, False)