#NEWLINE# def _remove_flat_installation( placeholder ) : #NEWLINE# #INDENT# if ( not os . path . isdir ( placeholder ) ) : #NEWLINE# #INDENT# log . warn ( 'Unkown installation at %s' , placeholder ) #NEWLINE# return False #NEWLINE# #UNINDENT# found = False #NEWLINE# for file in os . listdir ( placeholder ) : #NEWLINE# #INDENT# if fnmatch . fnmatch ( file , 'setuptools*.egg-info' ) : #NEWLINE# #INDENT# found = True #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# if ( not found ) : #NEWLINE# #INDENT# log . warn ( 'Could not locate setuptools*.egg-info' ) #NEWLINE# return #NEWLINE# #UNINDENT# log . warn ( 'Removing elements out of the way...' ) #NEWLINE# pkg_info = os . path . join ( placeholder , file ) #NEWLINE# if os . path . isdir ( pkg_info ) : #NEWLINE# #INDENT# patched = _patch_egg_dir ( pkg_info ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# patched = _patch_file ( pkg_info , SETUPTOOLS_PKG_INFO ) #NEWLINE# #UNINDENT# if ( not patched ) : #NEWLINE# #INDENT# log . warn ( '%s already patched.' , pkg_info ) #NEWLINE# return False #NEWLINE# #UNINDENT# for element in ( 'setuptools' , 'pkg_resources.py' , 'site.py' ) : #NEWLINE# #INDENT# element = os . path . join ( placeholder , element ) #NEWLINE# if os . path . exists ( element ) : #NEWLINE# #INDENT# _rename_path ( element ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# log . warn ( 'Could not find the %s element of the Setuptools distribution' , element ) #NEWLINE# #UNINDENT# #UNINDENT# return True