B
    Uvg                 @   sh   d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	 d dl
mZ d dlmZ G dd	 d	eZd
S )    )absolute_import)canonicalize_name)Command)InstallationError)parse_requirements)install_req_from_line)(protect_pip_from_modification_on_windowsc                   s4   e Zd ZdZdZdZdZ fddZdd Z  Z	S )	UninstallCommandaB  
    Uninstall packages.

    pip is able to uninstall most installed packages. Known exceptions are:

    - Pure distutils packages installed with ``python setup.py install``, which
      leave behind no metadata to determine what files were installed.
    - Script wrappers installed by ``python setup.py develop``.
    	uninstallzU
      %prog [options] <package> ...
      %prog [options] -r <requirements file> ...zUninstall packages.c          	      sV   t t| j|| | jjddddg ddd | jjdd	d
ddd | jd| j d S )Nz-rz--requirementrequirementsappendfilezjUninstall all the packages listed in the given requirements file.  This option can be used multiple times.)destactiondefaultmetavarhelpz-yz--yesyes
store_truez2Don't ask for confirmation of uninstall deletions.)r   r   r   r   )superr	   __init__cmd_opts
add_optionparserinsert_option_group)selfargskw)	__class__ A/tmp/pip-install-r_9ig3yj/pip/pip/_internal/commands/uninstall.pyr      s    zUninstallCommand.__init__c       	   	   C   s   |  |}i }x.|D ]&}t||jd}|jr||t|j< qW x:|jD ]0}x*t|||dD ]}|jr\||t|j< q\W qHW |stdt| jd t	d|kd x2|
 D ]&}|j|j| jdkd}|r|  qW W d Q R X d S )	N)isolated)optionssessionzLYou must give at least one requirement to %(name)s (see "pip help %(name)s"))namepip)modifying_pipr   )auto_confirmverbose)_build_sessionr   isolated_moder$   r   r   r   r   dictr   valuesr
   r   	verbositycommit)	r   r"   r   r#   reqs_to_uninstallr$   reqfilenameuninstall_pathsetr   r   r    run/   s2    
zUninstallCommand.run)
__name__
__module____qualname____doc__r$   usagesummaryr   r3   __classcell__r   r   )r   r    r	      s   	r	   N)
__future__r   pip._vendor.packaging.utilsr   pip._internal.cli.base_commandr   pip._internal.exceptionsr   Zpip._internal.reqr   pip._internal.req.constructorsr   pip._internal.utils.miscr   r	   r   r   r   r    <module>   s   