summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/portage/dbapi/__init__.py3
-rw-r--r--pym/portage/dbapi/porttree.py1
-rw-r--r--pym/portage/dbapi/vartree.py8
-rw-r--r--pym/portage/dbapi/virtual.py4
4 files changed, 8 insertions, 8 deletions
diff --git a/pym/portage/dbapi/__init__.py b/pym/portage/dbapi/__init__.py
index d41a7fba3..cd3208d50 100644
--- a/pym/portage/dbapi/__init__.py
+++ b/pym/portage/dbapi/__init__.py
@@ -15,6 +15,7 @@ from portage.versions import catpkgsplit, catsplit, pkgcmp
class dbapi(object):
_category_re = re.compile(r'^\w[-.+\w]*$')
_pkg_dir_name_re = re.compile(r'^\w[-+\w]*$')
+ _categories = None
def __init__(self):
pass
@@ -25,7 +26,7 @@ class dbapi(object):
can delete the self._categories attribute in cases when the cached
categories become invalid and need to be regenerated.
"""
- if hasattr(self, "_categories"):
+ if self._categories is not None:
return self._categories
categories = set()
cat_pattern = re.compile(r'(.*)/.*')
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index 7ce65b998..61ce3c47b 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -39,7 +39,6 @@ class portdbapi(dbapi):
else:
from portage import settings
self.mysettings = config(clone=settings)
- self._categories = set(self.mysettings.categories)
# This is strictly for use in aux_get() doebuild calls when metadata
# is generated by the depend phase. It's safest to use a clone for
# this purpose because doebuild makes many changes to the config
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index bfed2f798..15c2586ea 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1073,8 +1073,8 @@ class dblink(object):
The caller must ensure that lockdb() and unlockdb() are called
before and after this method.
"""
- if hasattr(self.vartree.dbapi, "_categories"):
- del self.vartree.dbapi._categories
+ if self.vartree.dbapi._categories is not None:
+ self.vartree.dbapi._categories = None
# When others_in_slot is supplied, the security check has already been
# done for this slot, so it shouldn't be repeated until the next
# replacement or unmerge operation.
@@ -2428,8 +2428,8 @@ class dblink(object):
we won't be able to later if they get unmerged (happens
when namespace changes).
"""
- if hasattr(self.vartree.dbapi, "_categories"):
- del self.vartree.dbapi._categories
+ if self.vartree.dbapi._categories is not None:
+ self.vartree.dbapi._categories = None
if self.myroot == "/" and \
"sys-apps" == self.cat and \
"portage" == pkgsplit(self.pkg)[0] and \
diff --git a/pym/portage/dbapi/virtual.py b/pym/portage/dbapi/virtual.py
index 3d5472f1e..444b5363a 100644
--- a/pym/portage/dbapi/virtual.py
+++ b/pym/portage/dbapi/virtual.py
@@ -26,8 +26,8 @@ class fakedbapi(dbapi):
self._match_cache = {}
def _clear_cache(self):
- if hasattr(self, "_categories"):
- del self._categories
+ if self._categories is not None:
+ self._categories = None
if self._match_cache:
self._match_cache = {}