� ��abc@@s�ddlmZddlZddlZddlZddlmZmZmZddl m Z ddl m Z m Z mZmZmZddlmZeje�Zdefd��YZd efd ��YZdS( i(tabsolute_importN(t uses_pycachetWINDOWStcache_from_source(tUninstallationError(trmtreetasktis_localtrenamestnormalize_path(t indent_logtUninstallPathSetcB@sbeZdZd�Zd�Zd�Zd�Zd�Zd�Ze d�Z d�Z d �Z RS( sMA set of file paths to be removed in the uninstallation of a requirement.cC@s@t�|_t�|_i|_||_d|_g|_dS(N(tsettpathst_refusetpthtdisttNonetsave_dirt _moved_paths(tselfR((s9/usr/lib/python2.7/site-packages/pip/req/req_uninstall.pyt__init__s      cC@s t|�S(ss Return True if the given path is one we are permitted to remove/modify, False otherwise. (R(Rtpath((s9/usr/lib/python2.7/site-packages/pip/req/req_uninstall.pyt _permittedscC@s�tjj|�\}}tjjt|�tjj|��}tjj|�sUdS|j|�rw|jj |�n|j j |�tjj |�ddkr�t r�|j t |��ndS(Nis.py(tosRtsplittjoinR tnormcasetexistsRR taddRtsplitextRR(RRtheadttail((s9/usr/lib/python2.7/site-packages/pip/req/req_uninstall.pyR#s'"cC@skt|�}|j|�rW||jkr@t|�|j|trollback(RRttmp_pathR((s9/usr/lib/python2.7/site-packages/pip/req/req_uninstall.pyRE{s cC@s5|jdk r1t|j�d|_g|_ndS(s?Remove temporary save dir: rollback will no longer be possible.N(RRRR(R((s9/usr/lib/python2.7/site-packages/pip/req/req_uninstall.pytcommit�s  ( t__name__t __module__t__doc__RRRR$R.R1RDR?RERG(((s9/usr/lib/python2.7/site-packages/pip/req/req_uninstall.pyR s      * R!cB@s,eZd�Zd�Zd�Zd�ZRS(cC@sGtjj|�s%td|��n||_t�|_d|_dS(Ns.Cannot remove entries from nonexistent file %s( RRtisfileRtfileR tentriesRt _saved_lines(RR"((s9/usr/lib/python2.7/site-packages/pip/req/req_uninstall.pyR�s   cC@sXtjj|�}trDtjj|�d rD|jdd�}n|jj|�dS(Nis\t/(RRRRR/treplaceRMR(RR#((s9/usr/lib/python2.7/site-packages/pip/req/req_uninstall.pyR�scC@s�tjd|j�t|jd��}|j�}||_WdQXtd�|D��rbd}nd}xS|jD]H}y.tjd|�|j||j d��Wqrt k r�qrXqrWt|jd��}|j |�WdQXdS( NsRemoving pth entries from %s:trbcs@s|]}d|kVqdS(s N((t.0tline((s9/usr/lib/python2.7/site-packages/pip/req/req_uninstall.pys �ss s sRemoving entry: %ssutf-8twb( R6R<RLtopent readlinesRNR(RMR?tencodet ValueErrort writelines(RtfhtlinestendlineR#((s9/usr/lib/python2.7/site-packages/pip/req/req_uninstall.pyR?�s   cC@sh|jdkr&tjd|j�tStjd|j�t|jd��}|j|j�WdQXt S(Ns.Cannot roll back changes to %s, none were mades!Rolling %s back to previous stateRT( RNRR6RCRLRDR<RURYtTrue(RRZ((s9/usr/lib/python2.7/site-packages/pip/req/req_uninstall.pyRE�s (RHRIRRR?RE(((s9/usr/lib/python2.7/site-packages/pip/req/req_uninstall.pyR!�s (t __future__RtloggingRR:t pip.compatRRRtpip.exceptionsRt pip.utilsRRRRR tpip.utils.loggingR t getLoggerRHR6tobjectR R!(((s9/usr/lib/python2.7/site-packages/pip/req/req_uninstall.pyts   (�