environment/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg/pip/req.py
def uninstall(self, auto_confirm=False):
        """
        Uninstall the distribution currently satisfying this requirement.

        Prompts before removing or modifying files unless
        ``auto_confirm`` is True.

        Refuses to delete or modify files outside of ``sys.prefix`` -
        thus uninstallation within a virtual environment can only
        modify that virtual environment, even if the virtualenv is
        linked to global site-packages.

        """
        if not self.check_if_exists():
            raise UninstallationError("Cannot uninstall requirement %s, not installed" % (self.name,))
        dist = self.satisfied_by or self.conflicts_with

        paths_to_remove = UninstallPathSet(dist)

        pip_egg_info_path = os.path.join(dist.location,
                                         dist.egg_name()) + '.egg-info'
        # workaround for http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=618367
        debian_egg_info_path = pip_egg_info_path.replace(
            '-py%s' % pkg_resources.PY_MAJOR, '')
        easy_install_egg = dist.egg_name() + '.egg'
        develop_egg_link = egg_link_path(dist)

        pip_egg_info_exists = os.path.exists(pip_egg_info_path)
        debian_egg_info_exists = os.path.exists(debian_egg_info_path)
        if pip_egg_info_exists or debian_egg_info_exists:
            # package installed by pip
            if pip_egg_info_exists:
                egg_info_path = pip_egg_info_path
            else:
                egg_info_path = debian_egg_info_path
            paths_to_remove.add(egg_info_path)
            if dist.has_metadata('installed-files.txt'):
                for installed_file in dist.get_metadata('installed-files.txt').splitlines():
                    path = os.path.normpath(os.path.join(egg_info_path, installed_file))
                    paths_to_remove.add(path)
            #FIXME: need a test for this elif block
            #occurs with --single-version-externally-managed/--record outside of pip
            elif dist.has_metadata('top_level.txt'):
                if dist.has_metadata('namespace_packages.txt'):
                    namespaces = dist.get_metadata('namespace_packages.txt')
                else:
                    namespaces = []
                for top_level_pkg in [p for p
                                      in dist.get_metadata('top_level.txt').splitlines()
                                      if p and p not in namespaces]:
                    path = os.path.join(dist.location, top_level_pkg)
                    paths_to_remove.add(path)
                    paths_to_remove.add(path + '.py')
                    paths_to_remove.add(path + '.pyc')

        elif dist.location.endswith(easy_install_egg):
            # package installed by easy_install
            paths_to_remove.add(dist.location)
            easy_install_pth = os.path.join(os.path.dirname(dist.location),
                                            'easy-install.pth')
            paths_to_remove.add_pth(easy_install_pth, './' + easy_install_egg)

        elif develop_egg_link:
            # develop egg
            fh = open(develop_egg_link, 'r')
            link_pointer = os.path.normcase(fh.readline().strip())
            fh.close()
            assert (link_pointer == dist.location), 'Egg-link %s does not match installed location of %s (at %s)' % (link_pointer, self.name, dist.location)
            paths_to_remove.add(develop_egg_link)
            easy_install_pth = os.path.join(os.path.dirname(develop_egg_link),
                                            'easy-install.pth')
            paths_to_remove.add_pth(easy_install_pth, dist.location)

        # find distutils scripts= scripts
        if dist.has_metadata('scripts') and dist.metadata_isdir('scripts'):
            for script in dist.metadata_listdir('scripts'):
                paths_to_remove.add(os.path.join(bin_py, script))
                if sys.platform == 'win32':
                    paths_to_remove.add(os.path.join(bin_py, script) + '.bat')

        # find console_scripts
        if dist.has_metadata('entry_points.txt'):
            config = ConfigParser.SafeConfigParser()
            config.readfp(FakeFile(dist.get_metadata_lines('entry_points.txt')))
            if config.has_section('console_scripts'):
                for name, value in config.items('console_scripts'):
                    paths_to_remove.add(os.path.join(bin_py, name))
                    if sys.platform == 'win32':
                        paths_to_remove.add(os.path.join(bin_py, name) + '.exe')
                        paths_to_remove.add(os.path.join(bin_py, name) + '.exe.manifest')
                        paths_to_remove.add(os.path.join(bin_py, name) + '-script.py')

        paths_to_remove.remove(auto_confirm)
        self.uninstalled = paths_to_remove
def uninstall(self, auto_confirm=False):
        """
        Uninstall the distribution currently satisfying this requirement.

        Prompts before removing or modifying files unless
        ``auto_confirm`` is True.

        Refuses to delete or modify files outside of ``sys.prefix`` -
        thus uninstallation within a virtual environment can only
        modify that virtual environment, even if the virtualenv is
        linked to global site-packages.

        """
        if not self.check_if_exists():
            raise UninstallationError("Cannot uninstall requirement %s, not installed" % (self.name,))
        dist = self.satisfied_by or self.conflicts_with

        paths_to_remove = UninstallPathSet(dist)

        pip_egg_info_path = os.path.join(dist.location,
                                         dist.egg_name()) + '.egg-info'
        # workaround for http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=618367
        debian_egg_info_path = pip_egg_info_path.replace(
            '-py%s' % pkg_resources.PY_MAJOR, '')
        easy_install_egg = dist.egg_name() + '.egg'
        develop_egg_link = egg_link_path(dist)

        pip_egg_info_exists = os.path.exists(pip_egg_info_path)
        debian_egg_info_exists = os.path.exists(debian_egg_info_path)
        if pip_egg_info_exists or debian_egg_info_exists:
            # package installed by pip
            if pip_egg_info_exists:
                egg_info_path = pip_egg_info_path
            else:
                egg_info_path = debian_egg_info_path
            paths_to_remove.add(egg_info_path)
            if dist.has_metadata('installed-files.txt'):
                for installed_file in dist.get_metadata('installed-files.txt').splitlines():
                    path = os.path.normpath(os.path.join(egg_info_path, installed_file))
                    paths_to_remove.add(path)
            #FIXME: need a test for this elif block
            #occurs with --single-version-externally-managed/--record outside of pip
            elif dist.has_metadata('top_level.txt'):
                if dist.has_metadata('namespace_packages.txt'):
                    namespaces = dist.get_metadata('namespace_packages.txt')
                else:
                    namespaces = []
                for top_level_pkg in [p for p
                                      in dist.get_metadata('top_level.txt').splitlines()
                                      if p and p not in namespaces]:
                    path = os.path.join(dist.location, top_level_pkg)
                    paths_to_remove.add(path)
                    paths_to_remove.add(path + '.py')
                    paths_to_remove.add(path + '.pyc')

        elif dist.location.endswith(easy_install_egg):
            # package installed by easy_install
            paths_to_remove.add(dist.location)
            easy_install_pth = os.path.join(os.path.dirname(dist.location),
                                            'easy-install.pth')
            paths_to_remove.add_pth(easy_install_pth, './' + easy_install_egg)

        elif develop_egg_link:
            # develop egg
            fh = open(develop_egg_link, 'r')
            link_pointer = os.path.normcase(fh.readline().strip())
            fh.close()
            assert (link_pointer == dist.location), 'Egg-link %s does not match installed location of %s (at %s)' % (link_pointer, self.name, dist.location)
            paths_to_remove.add(develop_egg_link)
            easy_install_pth = os.path.join(os.path.dirname(develop_egg_link),
                                            'easy-install.pth')
            paths_to_remove.add_pth(easy_install_pth, dist.location)

        # find distutils scripts= scripts
        if dist.has_metadata('scripts') and dist.metadata_isdir('scripts'):
            for script in dist.metadata_listdir('scripts'):
                paths_to_remove.add(os.path.join(bin_py, script))
                if sys.platform == 'win32':
                    paths_to_remove.add(os.path.join(bin_py, script) + '.bat')

        # find console_scripts
        if dist.has_metadata('entry_points.txt'):
            config = ConfigParser.SafeConfigParser()
            config.readfp(FakeFile(dist.get_metadata_lines('entry_points.txt')))
            if config.has_section('console_scripts'):
                for name, value in config.items('console_scripts'):
                    paths_to_remove.add(os.path.join(bin_py, name))
                    if sys.platform == 'win32':
                        paths_to_remove.add(os.path.join(bin_py, name) + '.exe')
                        paths_to_remove.add(os.path.join(bin_py, name) + '.exe.manifest')
                        paths_to_remove.add(os.path.join(bin_py, name) + '-script.py')

        paths_to_remove.remove(auto_confirm)
        self.uninstalled = paths_to_remove
def uninstall ( self , auto_confirm = False ) : if not self . check_if_exists ( ) : raise UninstallationError ( "Cannot uninstall requirement %s, not installed" % ( self . name , ) ) dist = self . satisfied_by or self . conflicts_with paths_to_remove = UninstallPathSet ( dist ) pip_egg_info_path = os . path . join ( dist . location , dist . egg_name ( ) ) + '.egg-info' # workaround for http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=618367 debian_egg_info_path = pip_egg_info_path . replace ( '-py%s' % pkg_resources . PY_MAJOR , '' ) easy_install_egg = dist . egg_name ( ) + '.egg' develop_egg_link = egg_link_path ( dist ) pip_egg_info_exists = os . path . exists ( pip_egg_info_path ) debian_egg_info_exists = os . path . exists ( debian_egg_info_path ) if pip_egg_info_exists or debian_egg_info_exists : # package installed by pip if pip_egg_info_exists : egg_info_path = pip_egg_info_path else : egg_info_path = debian_egg_info_path paths_to_remove . add ( egg_info_path ) if dist . has_metadata ( 'installed-files.txt' ) : for installed_file in dist . get_metadata ( 'installed-files.txt' ) . splitlines ( ) : path = os . path . normpath ( os . path . join ( egg_info_path , installed_file ) ) paths_to_remove . add ( path ) #FIXME: need a test for this elif block #occurs with --single-version-externally-managed/--record outside of pip elif dist . has_metadata ( 'top_level.txt' ) : if dist . has_metadata ( 'namespace_packages.txt' ) : namespaces = dist . get_metadata ( 'namespace_packages.txt' ) else : namespaces = [ ] for top_level_pkg in [ p for p in dist . get_metadata ( 'top_level.txt' ) . splitlines ( ) if p and p not in namespaces ] : path = os . path . join ( dist . location , top_level_pkg ) paths_to_remove . add ( path ) paths_to_remove . add ( path + '.py' ) paths_to_remove . add ( path + '.pyc' ) elif dist . location . endswith ( easy_install_egg ) : # package installed by easy_install paths_to_remove . add ( dist . location ) easy_install_pth = os . path . join ( os . path . dirname ( dist . location ) , 'easy-install.pth' ) paths_to_remove . add_pth ( easy_install_pth , './' + easy_install_egg ) elif develop_egg_link : # develop egg fh = open ( develop_egg_link , 'r' ) link_pointer = os . path . normcase ( fh . readline ( ) . strip ( ) ) fh . close ( ) assert ( link_pointer == dist . location ) , 'Egg-link %s does not match installed location of %s (at %s)' % ( link_pointer , self . name , dist . location ) paths_to_remove . add ( develop_egg_link ) easy_install_pth = os . path . join ( os . path . dirname ( develop_egg_link ) , 'easy-install.pth' ) paths_to_remove . add_pth ( easy_install_pth , dist . location ) # find distutils scripts= scripts if dist . has_metadata ( 'scripts' ) and dist . metadata_isdir ( 'scripts' ) : for script in dist . metadata_listdir ( 'scripts' ) : paths_to_remove . add ( os . path . join ( bin_py , script ) ) if sys . platform == 'win32' : paths_to_remove . add ( os . path . join ( bin_py , script ) + '.bat' ) # find console_scripts if dist . has_metadata ( 'entry_points.txt' ) : config = ConfigParser . SafeConfigParser ( ) config . readfp ( FakeFile ( dist . get_metadata_lines ( 'entry_points.txt' ) ) ) if config . has_section ( 'console_scripts' ) : for name , value in config . items ( 'console_scripts' ) : paths_to_remove . add ( os . path . join ( bin_py , name ) ) if sys . platform == 'win32' : paths_to_remove . add ( os . path . join ( bin_py , name ) + '.exe' ) paths_to_remove . add ( os . path . join ( bin_py , name ) + '.exe.manifest' ) paths_to_remove . add ( os . path . join ( bin_py , name ) + '-script.py' ) paths_to_remove . remove ( auto_confirm ) self . uninstalled = paths_to_remove
Uninstall the distribution currently satisfying this requirement.

        Prompts before removing or modifying files unless
        ``auto_confirm`` is True.

        Refuses to delete or modify files outside of ``sys.prefix`` -
        thus uninstallation within a virtual environment can only
        modify that virtual environment, even if the virtualenv is
        linked to global site-packages.
Uninstall the distribution currently satisfying this requirement .