File: //usr/lib/python2.7/site-packages/pip/req/req_uninstall.pyo
�
��abc           @@  s�   d  d l  m Z d  d l Z d  d l Z d  d l Z d  d l m Z m Z m Z d  d l	 m
 Z
 d  d l m Z m
 Z
 m Z m Z m Z d  d l m Z e j e � Z d e f d �  �  YZ d	 e f d
 �  �  YZ d S(   i    (   t   absolute_importN(   t   uses_pycachet   WINDOWSt   cache_from_source(   t   UninstallationError(   t   rmtreet   askt   is_localt   renamest   normalize_path(   t
   indent_logt   UninstallPathSetc           B@  sb   e  Z d  Z d �  Z d �  Z d �  Z d �  Z d �  Z d �  Z e	 d � Z
 d �  Z d	 �  Z RS(
   sM   A set of file paths to be removed in the uninstallation of a
    requirement.c         C@  s@   t  �  |  _ t  �  |  _ i  |  _ | |  _ d  |  _ g  |  _ d  S(   N(   t   sett   pathst   _refuset   ptht   distt   Nonet   save_dirt   _moved_paths(   t   selfR   (    (    s9   /usr/lib/python2.7/site-packages/pip/req/req_uninstall.pyt   __init__   s    			c         C@  s
   t  | � S(   ss   
        Return True if the given path is one we are permitted to
        remove/modify, False otherwise.
        (   R   (   R   t   path(    (    s9   /usr/lib/python2.7/site-packages/pip/req/req_uninstall.pyt
   _permitted   s    c         C@  s�   t  j j | � \ } } t  j j t | � t  j j | � � } t  j j | � sU d  S|  j | � rw |  j j	 | � n |  j
 j	 | � t  j j | � d d k r� t r� |  j	 t
 | � � n  d  S(   Ni   s   .py(   t   osR   t   splitt   joinR	   t   normcaset   existsR   R
   t   addR   t   splitextR   R   (   R   R   t   headt   tail(    (    s9   /usr/lib/python2.7/site-packages/pip/req/req_uninstall.pyR   #   s    '"c         C@  sk   t  | � } |  j | � rW | |  j k r@ t | � |  j | <n  |  j | j | � n |  j j | � d  S(   N(   R	   R   R   t   UninstallPthEntriesR   R   (   R   t   pth_filet   entry(    (    s9   /usr/lib/python2.7/site-packages/pip/req/req_uninstall.pyt   add_pth6   s    c         C@  s�   t  �  } x} t | d t �D]i } t g  | D]@ } | j | � oi | t | j t j j � � t j j k ^ q, � s | j	 | � q q W| S(   s�   Compact a path set to contain the minimal number of paths
        necessary to contain all paths in the set. If /a/path/ and
        /a/path/to/a/file.txt are both in the set, leave only the
        shorter path.t   key(
   R   t   sortedt   lent   anyt
   startswitht   rstripR   R   t   sepR   (   R   R
   t   short_pathsR   t	   shortpath(    (    s9   /usr/lib/python2.7/site-packages/pip/req/req_uninstall.pyt   compact?   s    	Mc         C@  s5   t  j j |  j t  j j | � d j t  j j � � S(   Ni   (   R   R   R   R   t
   splitdrivet   lstripR+   (   R   R   (    (    s9   /usr/lib/python2.7/site-packages/pip/req/req_uninstall.pyt   _stashM   s    	c      	   C@  s�  |  j  s# t j d |  j j � d St j d |  j j |  j j � t �  �Vt |  j |  j  � � } | rs d } n- x | D] } t j | � qz Wt	 d d � } |  j
 r� t j d � x* |  j |  j
 � D] } t j | � q� Wn  | d k r�t j d d	 d
 d � |  _
 xJ | D]B } |  j | � } t j d | � |  j j | � t | | � qWx! |  j j �  D] } | j �  qgWt j d
 |  j j |  j j � n  Wd QXd S(   s[   Remove paths in ``self.paths`` with confirmation (unless
        ``auto_confirm`` is True).s7   Can't uninstall '%s'. No files were found to uninstall.Ns   Uninstalling %s-%s:t   ys   Proceed (y/n)? t   ns.   Not removing or modifying (outside of prefix):t   suffixs
   -uninstallt   prefixs   pip-s   Removing file or directory %ss   Successfully uninstalled %s-%s(   R2   R3   (   R
   t   loggert   infoR   t   project_namet   versionR
   R&