
§|jD  ã               @   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 Gd d „  d e
 ƒ Z d S)	é    )Úabsolute_importN)Ú
WheelCache)ÚInstallRequirementÚRequirementSetÚparse_requirements)ÚCommand)ÚInstallationErrorc                   sF   e  Z d  Z d Z d Z d Z d Z ‡  f d d †  Z d d „  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                s‰   t  t |  ƒ j | | Ž  |  j j d d d d d d d g  d d	 d
 d ƒ|  j j d d d d d d d
 d ƒ|  j j d |  j ƒ d  S)Nz-rz--requirementÚdestÚrequirementsÚactionÚappendÚdefaultÚmetavarÚfileÚhelpzjUninstall all the packages listed in the given requirements file.  This option can be used multiple times.z-yz--yesÚyesÚ
store_truez2Don't ask for confirmation of uninstall deletions.r   )Úsuperr	   Ú__init__Úcmd_optsÚ
add_optionÚparserÚinsert_option_group)ÚselfÚargsÚkw)Ú	__class__© ú5/tmp/pip-build-5c7ija6t/pip/pip/commands/uninstall.pyr      s    				zUninstallCommand.__init__c       
      C   s2  |  j  | ƒ �} t j j t ƒ  t ƒ  ƒ } t | j | ƒ } t d d  d d  d d  d | j d | d | ƒ } x3 | D]+ } | j	 t
 j | d | j d | ƒƒ qv WxG | j D]< } x3 t | d | d | d | ƒD] }	 | j	 |	 ƒ qÔ Wq¯ W| j st d t d	 |  j ƒ ƒ ‚ | j d
 | j ƒ Wd  QRXd  S)NÚ	build_dirÚsrc_dirÚdownload_dirÚisolatedÚsessionÚwheel_cacheÚoptionszLYou 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   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   