From cc58c8587a4e67f389b00e5d3278fae049ac7399 Mon Sep 17 00:00:00 2001 From: Luca Falavigna Date: Mon, 11 Mar 2013 22:26:43 +0100 Subject: Imported Upstream version 2.3.0 --- engine/SCons/exitfuncs.py | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) (limited to 'engine/SCons/exitfuncs.py') diff --git a/engine/SCons/exitfuncs.py b/engine/SCons/exitfuncs.py index 4e604e1..26df198 100644 --- a/engine/SCons/exitfuncs.py +++ b/engine/SCons/exitfuncs.py @@ -5,7 +5,7 @@ Register functions which are executed when SCons exits for any reason. """ # -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -27,9 +27,10 @@ Register functions which are executed when SCons exits for any reason. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/exitfuncs.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo" +__revision__ = "src/engine/SCons/exitfuncs.py 2013/03/03 09:48:35 garyo" +import atexit _exithandlers = [] def _run_exitfuncs(): @@ -52,23 +53,9 @@ def register(func, *targs, **kargs): """ _exithandlers.append((func, targs, kargs)) -import sys -try: - x = sys.exitfunc - - # if x isn't our own exit func executive, assume it's another - # registered exit function - append it to our list... - if x != _run_exitfuncs: - register(x) - -except AttributeError: - pass - -# make our exit function get run by python when it exits: -sys.exitfunc = _run_exitfuncs - -del sys +# make our exit function get run by python when it exits +atexit.register(_run_exitfuncs) # Local Variables: # tab-width:4 -- cgit v1.2.3