From 34b54ba9e854b13f0413383979824ac3f90a2686 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 12 May 2011 11:42:08 -0700 Subject: cache.sqlite: handle readonly --- pym/portage/cache/sqlite.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pym/portage/cache/sqlite.py b/pym/portage/cache/sqlite.py index d15b6ece1..4eb340bb0 100644 --- a/pym/portage/cache/sqlite.py +++ b/pym/portage/cache/sqlite.py @@ -31,7 +31,7 @@ class database(fs_template.FsBased): self.location = os.path.join(self.location, self.label.lstrip(os.path.sep).rstrip(os.path.sep)) - if not os.path.exists(self.location): + if not self.readonly and not os.path.exists(self.location): self._ensure_dirs() config.setdefault("autocommit", self.autocommits) @@ -72,7 +72,8 @@ class database(fs_template.FsBased): connection_kwargs = {} connection_kwargs["timeout"] = config["timeout"] try: - self._ensure_dirs() + if not self.readonly: + self._ensure_dirs() self._db_connection = self._db_module.connect( database=_unicode_decode(self._dbpath), **connection_kwargs) self._db_cursor = self._db_connection.cursor() -- cgit v1.2.3-1-g7c22