#NEWLINE# def _do_link( orig_file , final_file ) : #NEWLINE# #INDENT# 'Perform a soft link of the original file into the final location.\n\n    We need the symlink to point to /anaconda/bin directory, not the real location\n    in the pkgs directory so conda can resolve LD_LIBRARY_PATH and the interpreters.\n    ' #NEWLINE# needs_link = True #NEWLINE# if os . path . exists ( final_file ) : #NEWLINE# #INDENT# if ( ( os . path . realpath ( final_file ) == os . path . realpath ( orig_file ) ) and ( orig_file == os . path . normpath ( os . path . join ( os . path . dirname ( final_file ) , os . readlink ( final_file ) ) ) ) ) : #NEWLINE# #INDENT# needs_link = False #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# os . remove ( final_file ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if os . path . lexists ( final_file ) : #NEWLINE# #INDENT# os . unlink ( final_file ) #NEWLINE# #UNINDENT# #UNINDENT# if needs_link : #NEWLINE# #INDENT# os . symlink ( os . path . relpath ( orig_file , os . path . dirname ( final_file ) ) , final_file )