σ •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   (ƒ