#NEWLINE# @ contextlib . contextmanager #NEWLINE# def setupSconsEnvironment( ) : #NEWLINE# #INDENT# os . environ [ 'NUITKA_SCONS' ] = getSconsDataPath ( ) #NEWLINE# if ( Utils . getOS ( ) == 'Windows' ) : #NEWLINE# #INDENT# os . environ [ 'SCONS_LIB_DIR' ] = Utils . joinpath ( getSconsInlinePath ( ) , 'lib' , 'scons-2.3.2' ) #NEWLINE# os . environ [ 'NUITKA_PYTHON_DLL_PATH' ] = getTargetPythonDLLPath ( ) #NEWLINE# os . environ [ 'NUITKA_PYTHON_EXE_PATH' ] = sys . executable #NEWLINE# #UNINDENT# if ( python_version >= 300 ) : #NEWLINE# #INDENT# if ( 'PYTHONPATH' in os . environ ) : #NEWLINE# #INDENT# old_pythonpath = os . environ [ 'PYTHONPATH' ] #NEWLINE# del os . environ [ 'PYTHONPATH' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# old_pythonpath = None #NEWLINE# #UNINDENT# if ( 'PYTHONHOME' in os . environ ) : #NEWLINE# #INDENT# old_pythonhome = os . environ [ 'PYTHONHOME' ] #NEWLINE# del os . environ [ 'PYTHONHOME' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# old_pythonhome = None #NEWLINE# #UNINDENT# #UNINDENT# ( yield ) #NEWLINE# if ( python_version >= 300 ) : #NEWLINE# #INDENT# if ( old_pythonpath is not None ) : #NEWLINE# #INDENT# os . environ [ 'PYTHONPATH' ] = old_pythonpath #NEWLINE# #UNINDENT# if ( old_pythonhome is not None ) : #NEWLINE# #INDENT# os . environ [ 'PYTHONHOME' ] = old_pythonpath #NEWLINE# #UNINDENT# #UNINDENT# if ( Utils . getOS ( ) == 'Windows' ) : #NEWLINE# #INDENT# del os . environ [ 'NUITKA_PYTHON_DLL_PATH' ] #NEWLINE# del os . environ [ 'NUITKA_PYTHON_EXE_PATH' ]