Do lazy initialization of portage.db[root][porttree] and db[root][vartree] for quicke...
authorZac Medico <zmedico@gentoo.org>
Mon, 24 Apr 2006 00:36:19 +0000 (00:36 -0000)
committerZac Medico <zmedico@gentoo.org>
Mon, 24 Apr 2006 00:36:19 +0000 (00:36 -0000)
svn path=/main/trunk/; revision=3206

pym/portage.py

index d7b854dbdfe0c3901619be92dddf3c001c996490..27891b6e9530fb4d434f9703a090bff86bafc8d9 100644 (file)
@@ -6503,11 +6503,11 @@ def do_vartree(mysettings):
        global db, root, settings
        db["/"] = portage_util.LazyItemsDict(db.get("/", None))
        db["/"].addLazySingleton("virtuals", settings.getvirtuals, "/")
-       db["/"]["vartree"] = vartree("/")
+       db["/"].addLazySingleton("vartree", vartree, "/")
        if root!="/":
                db[root] = portage_util.LazyItemsDict(db.get(root, None))
                db[root].addLazySingleton("virtuals", settings.getvirtuals, root)
-               db[root]["vartree"] = vartree(root)
+               db[root].addLazySingleton("vartree", vartree, root)
        #We need to create the vartree first, then load our settings, and then set up our other trees
 
 usedefaults=settings.use_defs
@@ -6835,10 +6835,10 @@ class LazyBintreeItem(object):
                        self._bintree.populate()
                return self._bintree
 
-db["/"]["porttree"] = portagetree("/")
+db["/"].addLazySingleton("porttree", portagetree, "/")
 db["/"].addLazyItem("bintree", LazyBintreeItem("/"))
 if root!="/":
-       db[root]["porttree"] = portagetree(root)
+       db[root].addLazySingleton("porttree", portagetree, root)
        db[root].addLazyItem("bintree", LazyBintreeItem(root))
 
 thirdpartymirrors = settings.thirdpartymirrors()