Make portdbapi.eclassdb a property.
authorZac Medico <zmedico@gentoo.org>
Sat, 10 Dec 2011 07:04:24 +0000 (23:04 -0800)
committerZac Medico <zmedico@gentoo.org>
Sat, 10 Dec 2011 07:04:24 +0000 (23:04 -0800)
pym/portage/dbapi/porttree.py

index e483edb93d473eeb22929679ba630c8ad3d2ed33..233a2c1d1592642e4f7050bd43fc56187c44ebfc 100644 (file)
@@ -59,6 +59,13 @@ class portdbapi(dbapi):
        def porttree_root(self):
                return self.settings.repositories.mainRepoLocation()
 
+       @property
+       def eclassdb(self):
+               main_repo = self.repositories.mainRepo()
+               if main_repo is None:
+                       return None
+               return main_repo.eclass_db
+
        def __init__(self, _unused_param=None, mysettings=None):
                """
                @param _unused_param: deprecated, use mysettings['PORTDIR'] instead
@@ -102,7 +109,6 @@ class portdbapi(dbapi):
                                        ":".join(filter(None, sandbox_write))
 
                self.porttrees = list(self.settings.repositories.repoLocationList())
-               self.eclassdb = self.repositories.mainRepo().eclass_db
 
                # This is used as sanity check for aux_get(). If there is no
                # root eclass dir, we assume that PORTDIR is invalid or