3
zYðiD  ã               @   s`   d dl mZ d dlZd dlmZ d dlmZmZmZ d dl	m
Z
 d dlmZ G dd„ de
ƒZdS )	é    )Úabsolute_importN)Ú
WheelCache)ÚInstallRequirementÚRequirementSetÚparse_requirements)ÚCommand)ÚInstallationErrorc                   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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__© ú5/tmp/pip-build-ue6tjl93/pip/pip/commands/uninstall.pyr      s    zUninstallCommand.__init__c       
      C   sÐ   | j |ƒ�¼}tjjtƒ tƒ ƒ}t|j|ƒ}td d d |j||d�}x$|D ]}|j	t
j||j|d�ƒ qFW x2|jD ](}x"t||||d�D ]}	|j	|	ƒ q„W qnW |js´tdt| jd� ƒ‚|j|jd� W d Q R X d S )N)Ú	build_dirÚsrc_dirÚdownload_dirÚisolatedÚsessionÚwheel_cache)r$   r&   )Úoptionsr%   r&   zLYou must give at least one requirement to %(name)s (see "pip help %(name)s"))Úname)Úauto_confirm)Ú_build_sessionÚpipÚindexÚFormatControlÚsetr   Ú	cache_dirr   Úisolated_modeÚadd_requirementr   Ú	from_liner   r   Úhas_requirementsr   Údictr(   r
   r   )
r   r'   r   r%   Úformat_controlr&   Úrequirement_setr(   ÚfilenameÚreqr   r   r    Úrun-   s6    
zUninstallCommand.run)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__r(   ÚusageÚsummaryr   r9   Ú__classcell__r   r   )r   r    r	   
   s   	r	   )Ú
__future__r   r+   Ú	pip.wheelr   Úpip.reqr   r   r   Úpip.basecommandr   Úpip.exceptionsr   r	   r   r   r   r    Ú<module>   s   