Your IP : 3.145.199.240


Current Path : /lib/python2.7/site-packages/pip/req/
Upload File :
Current File : //lib/python2.7/site-packages/pip/req/req_uninstall.pyc

�
��abc@@s�ddlmZddlZddlZddlZddlmZmZmZddl	m
Z
ddlm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�Zd	�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|<n|j|j|�n|jj|�dS(N(R	RRtUninstallPthEntriesRR(Rtpth_filetentry((s9/usr/lib/python2.7/site-packages/pip/req/req_uninstall.pytadd_pth6scC@s�t�}x}t|dt�D]i}tg|D]@}|j|�oi|t|jtjj��tjjk^q,�s|j	|�qqW|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.tkey(
Rtsortedtlentanyt
startswithtrstripRRtsepR(RR
tshort_pathsRt	shortpath((s9/usr/lib/python2.7/site-packages/pip/req/req_uninstall.pytcompact?s	McC@s5tjj|jtjj|�djtjj��S(Ni(RRRRt
splitdrivetlstripR+(RR((s9/usr/lib/python2.7/site-packages/pip/req/req_uninstall.pyt_stashMs	c	C@s�|js#tjd|jj�dStjd|jj|jj�t��Vt|j|j��}|rsd}n-x|D]}tj|�qzWt	dd�}|j
r�tjd�x*|j|j
�D]}tj|�q�Wn|dkr�tjdd	d
d�|_
xJ|D]B}|j|�}tjd|�|jj|�t||�qWx!|jj�D]}|j�qgWtjd
|jj|jj�nWdQXdS(s[Remove paths in ``self.paths`` with confirmation (unless
        ``auto_confirm`` is True).s7Can't uninstall '%s'. No files were found to uninstall.NsUninstalling %s-%s:tysProceed (y/n)? tns.Not removing or modifying (outside of prefix):tsuffixs
-uninstalltprefixspip-sRemoving file or directory %ssSuccessfully uninstalled %s-%s(R2R3(R
tloggertinfoRtproject_nametversionR
R&R.RRttempfiletmkdtempRR1tdebugRtappendRRtvaluestremove(Rtauto_confirmR
tresponseRtnew_pathR((s9/usr/lib/python2.7/site-packages/pip/req/req_uninstall.pyR?Qs@	

	
	

cC@s�|jdkr)tjd|jj�tStjd|jj�x=|jD]2}|j	|�}tj
d|�t||�qIWx!|jj
�D]}|j�q�WdS(s1Rollback the changes previously made by remove().s'Can't roll back %s; was not uninstalledsRolling back uninstall of %ssReplacing %sN(RRR6terrorRR8tFalseR7RR1R<RRR>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.pyRs							*	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	<genexpr>�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	getLoggerRHR6tobjectRR!(((s9/usr/lib/python2.7/site-packages/pip/req/req_uninstall.pyt<module>s(�

?>