Move registration of the close_portdbapi_caches() exit hook from the
authorZac Medico <zmedico@gentoo.org>
Sat, 4 Sep 2010 05:39:15 +0000 (22:39 -0700)
committerZac Medico <zmedico@gentoo.org>
Sat, 4 Sep 2010 05:39:15 +0000 (22:39 -0700)
portage base module to the portree module, so that the base portage
module can be imported without triggering import of the portage.process
(for atexit_register) and portage.dbapi.porttree modules. Also, don't
bother to commit the mtimedb in the exit hook since it's not really
needed.

pym/portage/__init__.py
pym/portage/dbapi/porttree.py

index d16ca3a15b30a3a572bfa841ceb2331ccbf6c6ce..cd1ad68751a9be8bf29a1e80749aee1507233a1e 100644 (file)
@@ -491,14 +491,6 @@ auxdbkeylen=len(auxdbkeys)
 def portageexit():
        if data.secpass > 1 and os.environ.get("SANDBOX_ON") != "1":
                close_portdbapi_caches()
-               try:
-                       mtimedb
-               except NameError:
-                       pass
-               else:
-                       mtimedb.commit()
-
-atexit_register(portageexit)
 
 def create_trees(config_root=None, target_root=None, trees=None):
        if trees is None:
index ed6b761b64a8a9fd395dfb91495b83604d933d76..793b738c782818bc765b18db43d8c9728adb5a86 100644 (file)
@@ -1053,6 +1053,8 @@ def close_portdbapi_caches():
        for i in portdbapi.portdbapi_instances:
                i.close_caches()
 
+portage.process.atexit_register(portage.portageexit)
+
 class portagetree(object):
        def __init__(self, root=None, virtual=None, settings=None):
                """