#NEWLINE# def uninstall( self , auto_confirm = False ) : #NEWLINE# #INDENT# '\n        Uninstall the distribution currently satisfying this requirement.\n\n        Prompts before removing or modifying files unless\n        ``auto_confirm`` is True.\n\n        Refuses to delete or modify files outside of ``sys.prefix`` -\n        thus uninstallation within a virtual environment can only\n        modify that virtual environment, even if the virtualenv is\n        linked to global site-packages.\n\n        ' #NEWLINE# if ( not self . check_if_exists ( ) ) : #NEWLINE# #INDENT# raise UninstallationError ( ( 'Cannot uninstall requirement %s, not installed' % ( self . name , ) ) ) #NEWLINE# #UNINDENT# dist = ( self . satisfied_by or self . conflicts_with ) #NEWLINE# paths_to_remove = UninstallPathSet ( dist ) #NEWLINE# pip_egg_info_path = ( os . path . join ( dist . location , dist . egg_name ( ) ) + '.egg-info' ) #NEWLINE# debian_egg_info_path = pip_egg_info_path . replace ( ( '-py%s' % pkg_resources . PY_MAJOR ) , '' ) #NEWLINE# easy_install_egg = ( dist . egg_name ( ) + '.egg' ) #NEWLINE# develop_egg_link = egg_link_path ( dist ) #NEWLINE# pip_egg_info_exists = os . path . exists ( pip_egg_info_path ) #NEWLINE# debian_egg_info_exists = os . path . exists ( debian_egg_info_path ) #NEWLINE# if ( pip_egg_info_exists or debian_egg_info_exists ) : #NEWLINE# #INDENT# if pip_egg_info_exists : #NEWLINE# #INDENT# egg_info_path = pip_egg_info_path #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# egg_info_path = debian_egg_info_path #NEWLINE# #UNINDENT# paths_to_remove . add ( egg_info_path ) #NEWLINE# if dist . has_metadata ( 'installed-files.txt' ) : #NEWLINE# #INDENT# for installed_file in dist . get_metadata ( 'installed-files.txt' ) . splitlines ( ) : #NEWLINE# #INDENT# path = os . path . normpath ( os . path . join ( egg_info_path , installed_file ) ) #NEWLINE# paths_to_remove . add ( path ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if dist . has_metadata ( 'top_level.txt' ) : #NEWLINE# #INDENT# if dist . has_metadata ( 'namespace_packages.txt' ) : #NEWLINE# #INDENT# namespaces = dist . get_metadata ( 'namespace_packages.txt' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# namespaces = [ ] #NEWLINE# #UNINDENT# for top_level_pkg in [ p for p in dist . get_metadata ( 'top_level.txt' ) . splitlines ( ) if ( p and ( p not in namespaces ) ) ] : #NEWLINE# #INDENT# path = os . path . join ( dist . location , top_level_pkg ) #NEWLINE# paths_to_remove . add ( path ) #NEWLINE# paths_to_remove . add ( ( path + '.py' ) ) #NEWLINE# paths_to_remove . add ( ( path + '.pyc' ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if dist . location . endswith ( easy_install_egg ) : #NEWLINE# #INDENT# paths_to_remove . add ( dist . location ) #NEWLINE# easy_install_pth = os . path . join ( os . path . dirname ( top_level_pkg . location ) , 'easy-install.pth' ) #NEWLINE# paths_to_remove . add_pth ( easy_install_pth , ( './' + easy_install_egg ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if develop_egg_link : #NEWLINE# #INDENT# fh = open ( develop_egg_link , 'r' ) #NEWLINE# link_pointer = os . path . normcase ( fh . readline ( ) . strip ( ) ) #NEWLINE# fh . close ( ) #NEWLINE# assert ( link_pointer == dist . location ) , ( 'Egg-link %s does not match installed location of %s (at %s)' % ( link_pointer , self . name , dist . location ) ) #NEWLINE# paths_to_remove . add ( develop_egg_link ) #NEWLINE# easy_install_pth = os . path . join ( os . path . dirname ( develop_egg_link ) , 'easy-install.pth' ) #NEWLINE# paths_to_remove . add_pth ( easy_install_pth , dist . location ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( dist . has_metadata ( 'scripts' ) and dist . metadata_isdir ( 'scripts' ) ) : #NEWLINE# #INDENT# for script in dist . metadata_listdir ( 'scripts' ) : #NEWLINE# #INDENT# paths_to_remove . add ( os . path . join ( bin_py , script ) ) #NEWLINE# if ( sys . platform == 'win32' ) : #NEWLINE# #INDENT# paths_to_remove . add ( ( os . path . join ( bin_py , script ) + '.bat' ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if dist . has_metadata ( 'entry_points.txt' ) : #NEWLINE# #INDENT# config = ConfigParser . SafeConfigParser ( ) #NEWLINE# config . readfp ( FakeFile ( dist . get_metadata_lines ( 'entry_points.txt' ) ) ) #NEWLINE# if config . has_section ( 'console_scripts' ) : #NEWLINE# #INDENT# for ( name , value ) in config . items ( 'console_scripts' ) : #NEWLINE# #INDENT# paths_to_remove . add ( os . path . join ( bin_py , name ) ) #NEWLINE# if ( sys . platform == 'win32' ) : #NEWLINE# #INDENT# paths_to_remove . add ( ( os . path . join ( bin_py , name ) + '.exe' ) ) #NEWLINE# paths_to_remove . add ( ( os . path . join ( bin_py , name ) + '.exe.manifest' ) ) #NEWLINE# paths_to_remove . add ( ( os . path . join ( bin_py , name ) + '-script.py' ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# paths_to_remove . remove ( auto_confirm ) #NEWLINE# self . uninstalled = paths_to_remove