diff options
author | René 'Necoro' Neumann <necoro@necoro.net> | 2009-08-14 19:42:01 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.net> | 2009-08-14 19:42:01 +0200 |
commit | 801316be64177d889ab21fc28c07dd4d77cb8184 (patch) | |
tree | 3966d67a043cb372bb51a9acdf533ef919122d44 | |
parent | 636eb3064e8ff8957bbf9fd172d7a0c6827e973c (diff) | |
download | portato-801316be64177d889ab21fc28c07dd4d77cb8184.tar.gz portato-801316be64177d889ab21fc28c07dd4d77cb8184.tar.bz2 portato-801316be64177d889ab21fc28c07dd4d77cb8184.zip |
Fix the EixSQLDatabase and EixReader
Diffstat (limited to '')
-rw-r--r-- | portato/db/eix_sql.py | 18 | ||||
-rw-r--r-- | portato/db/sql.py | 1 | ||||
-rw-r--r-- | portato/eix/parser.py | 2 |
3 files changed, 12 insertions, 9 deletions
diff --git a/portato/db/eix_sql.py b/portato/db/eix_sql.py index 0e4f569..ac31019 100644 --- a/portato/db/eix_sql.py +++ b/portato/db/eix_sql.py @@ -21,29 +21,31 @@ import os from .sql import SQLDatabase from ..eix import EixReader -from ..helper import debug +from ..helper import debug, warning from ..backend import system class EixSQLDatabase (SQLDatabase): - CACHE_FILE = "/var/eix/cache" + CACHE_FILE = "/var/cache/eix" def __init__ (self, session): - SQLDatabase.__init__(self, session) - if "cache" not in session: + self.cache = session.get("cache", self.CACHE_FILE) + if not os.path.exists(self.cache): + warning(_("Cache file '%s' does not exist. Using default instead."), self.cache) self.cache = self.CACHE_FILE - session["cache"] = self.cache - else: - self.cache = session["cache"] debug("Using '%s' as eix cache file.", self.cache) + + session["cache"] = self.cache + + SQLDatabase.__init__(self, session) def updated (self): mtime = os.stat(self.cache).st_mtime old = self.session.get("mtime", 0) - self.session["mtime"] = mtime + self.session["mtime"] = str(mtime) return old < mtime diff --git a/portato/db/sql.py b/portato/db/sql.py index 6c95bb3..f2a736e 100644 --- a/portato/db/sql.py +++ b/portato/db/sql.py @@ -256,3 +256,4 @@ class SQLDatabase (Database): self._restrict = "AND (name LIKE '%%%(restrict)s%%' OR cat LIKE '%(restrict)s%%')" % {"restrict":restrict} restrict = property(get_restrict, set_restrict) + con = staticmethod(con) diff --git a/portato/eix/parser.py b/portato/eix/parser.py index 2a6658b..cc42553 100644 --- a/portato/eix/parser.py +++ b/portato/eix/parser.py @@ -357,7 +357,7 @@ class package (object): The indices of `header.useflags` representing the IUSE value of the package. """ - __slots__ = ("name", "description", "provide", + __slots__ = ("_offset", "name", "description", "provide", "homepage", "license", "useflags") def __init__ (self, file, skip = False): |