From ce3f72b79f21e96003e075cb2f08faf8787df7da Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 3 Sep 2010 22:39:15 -0700 Subject: Move registration of the close_portdbapi_caches() exit hook from the 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 | 8 -------- pym/portage/dbapi/porttree.py | 2 ++ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index d16ca3a15..cd1ad6875 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -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: diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index ed6b761b6..793b738c7 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -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): """ -- cgit v1.2.3-1-g7c22