summaryrefslogtreecommitdiff
path: root/portato
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--portato/db/eix_sql.py18
-rw-r--r--portato/db/sql.py1
-rw-r--r--portato/eix/parser.py2
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):