Viewing File: /opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pyo

ó
“tÆ_c@@s
ddlmZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddlm
Z
mZddlmZmZmZddlmZddlmZmZmZmZmZmZmZmZmZdd	lm Z m!Z!dd
l"m#Z#e#ryddl$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-ddl.m/Z/nej0e1ƒZ2d
„Z3d„Z4e4d„ƒZ5d„Z6d„Z7d„Z8de9fd„ƒYZ:de9fd„ƒYZ;de9fd„ƒYZ<dS(i(tabsolute_importN(t
pkg_resources(tUninstallationError(tbin_pytbin_user(tWINDOWStcache_from_sourcetuses_pycache(t
indent_log(	tFakeFiletasktdist_in_usersitet
dist_is_localt
egg_link_pathtis_localtnormalize_pathtrenamestrmtree(tAdjacentTempDirectoryt
TempDirectory(tMYPY_CHECK_RUNNING(	tAnytCallabletDicttIterabletIteratortListtOptionaltSettTuple(tDistributioncC@s“t|ƒrt}nt}tjj||ƒ}|g}tr|j|dƒ|j|dƒ|r{|j|dƒq|j|dƒn|S(s‘Create the fully qualified name of the files created by
    {console,gui}_scripts for the given ``dist``.
    Returns the list of file names
    s.exes
.exe.manifests-script.pyws
-script.py(RRRtostpathtjoinRtappend(tdisttscript_nametis_guitbin_dirtexe_nametpaths_to_remove((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pyt
_script_names's		c@s"tjˆƒ‡fd†ƒ}|S(Nc?@sHtƒ}x8ˆ||ŽD]'}||kr|j|ƒ|VqqWdS(N(tsettadd(targstkwtseentitem(tfn(sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pytunique?s
	
(t	functoolstwraps(R0R1((R0sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pyt_unique=scc@sÄtjt|jdƒƒƒ}xŸ|D]—}tjj|j|dƒ}|V|jdƒr%tjj	|ƒ\}}|d }tjj||dƒ}|Vtjj||dƒ}|Vq%q%WdS(s
    Yield all the uninstallation paths for dist based on RECORD-without-.py[co]

    Yield paths to all the files in RECORD. For each .py file in RECORD, add
    the .pyc and .pyo in the same directory.

    UninstallPathSet.add() takes care of the __pycache__ .py[co].
    tRECORDis.pyiýÿÿÿs.pycs.pyoN(
tcsvtreaderR	tget_metadata_linesRR R!tlocationtendswithtsplit(R#trtrowR tdnR0tbase((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pytuninstallation_pathsJs

c@sktjj‰tƒ}xOt|dtƒD];‰t‡‡fd†|Dƒƒ}|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.tkeyc3@sO|]E}ˆj|jdƒƒoFˆt|jdƒjˆƒƒˆkVqdS(t*N(t
startswithtrstriptlen(t.0t	shortpath(R tsep(sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pys	<genexpr>ms(RR RHR*tsortedREtanyR+(tpathstshort_pathstshould_skip((R RHsP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pytcompactbs	
c	@sRtd„|Dƒƒ}t|ƒ}ttd„|jƒDƒƒdtƒ}tƒ}d„‰xÙ|D]щt‡fd†|Dƒƒr‹qcntƒ}tƒ}xftjˆƒD]U\‰}}|j‡‡‡fd†|Dƒƒ|j‡‡‡fd†|Dƒƒq­W||sc|j	|ƒ|j
ˆtjƒqcqcWtt|j
|ƒƒ|BS(s«Returns a set containing the paths that need to be renamed.

    This set may include directories when the original sequence of paths
    included every file on disk.
    cs@s'|]}tjj|ƒ|fVqdS(N(RR tnormcase(RFtp((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pys	<genexpr>}scs@s%|]}tjj|ƒdVqdS(iN(RR R;(RFRP((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pys	<genexpr>sRAcW@stjjtjj|ŒƒS(N(RR ROR!(ta((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pyt	norm_joinƒsc3@s*|] }tjjˆƒj|ƒVqdS(N(RR RORC(RFtw(troot(sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pys	<genexpr>ˆsc3@s!|]}ˆˆˆ|ƒVqdS(N((RFtd(tdirnameRRRT(sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pys	<genexpr>sc3@s!|]}ˆˆˆ|ƒVqdS(N((RFtf(RVRRRT(sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pys	<genexpr>’s(tdictR*RItvaluesRERJRtwalktupdatetdifference_updateR+RHtmapt__getitem__(	RKtcase_mapt	remainingt	uncheckedt	wildcardst	all_filestall_subdirstsubdirstfiles((RVRRRTsP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pytcompress_for_renamevs*		

		

c
C@st|ƒ}tƒ}tƒ}tƒ}xg|D]_}|jdƒrIq.n|jdƒsdd|kr€|jtjj|ƒƒn|j|ƒq.Wtttjj|ƒƒ}t|ƒ}x¦|D]ž}x•tj	|ƒD]„\}}	}
xr|
D]j}|jdƒrqëntjj
||ƒ}tjj|ƒrëtjj|ƒ|krë|j|ƒqëqëWqÕWq¿W|d„|DƒB}||fS(ssReturns a tuple of 2 sets of which paths to display to user

    The first set contains paths that would be deleted. Files of a package
    are not added and the top-level directory of the package has a '*' added
    at the end - to signify that all it's contents are removed.

    The second set contains files that would have been skipped in the above
    folders.
    s.pycs__init__.pys
.dist-infocS@s%h|]}tjj|dƒ’qS(RB(RR R!(RFtfolder((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pys	<setcomp>Ës	(R*R:R+RR RVR]RORNRZR!tisfile(
RKtwill_removet	will_skiptfoldersRfR t_normcased_filesRhtdirpatht_tdirfilestfnametfile_((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pytcompress_for_output_listingžs0			


tStashedUninstallPathSetcB@sSeZdZd„Zd„Zd„Zd„Zd„Zd„Ze	d„ƒZ
RS(sWA set of file rename operations to stash files while
    tentatively uninstalling them.cC@si|_g|_dS(N(t
_save_dirst_moves(tself((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pyt__init__Ôs	cC@sSyt|ƒ}Wn tk
r2tddƒ}nX||jtjj|ƒ<|jS(sStashes a directory.

        Directories are stashed adjacent to their original location if
        possible, or else moved/copied into the user's temp dir.tkindt	uninstall(RtOSErrorRRuRR RO(RwR tsave_dir((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pyt_get_directory_stashÝs
cC@sûtjj|ƒ}tjj|ƒd}}d}x}||kr‚y|j|}PWntk
renXtjj|ƒ|}}q4Wtjj|ƒ}tddƒ}||j|<tjj||ƒ}|rô|tjj	krôtjj
|j|ƒS|jS(s‚Stashes a file.

        If no root has been provided, one will be created for the directory
        in the user's temp directory.RyRzN(RR RORVtNoneRutKeyErrorRtrelpathtcurdirR!(RwR theadtold_headR|R€((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pyt_get_file_stashìs"


cC@s›tjj|ƒo"tjj|ƒ}|r=|j|ƒ}n|j|ƒ}|jj||fƒ|rŠtjj|ƒrŠtj|ƒnt	||ƒ|S(sStashes the directory or file and returns its new location.
        Handle symlinks as files to avoid modifying the symlink targets.
        (
RR tisdirtislinkR}R„RvR"trmdirR(RwR tpath_is_dirtnew_path((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pytstashs%
cC@s@x'|jjƒD]\}}|jƒqWg|_i|_dS(s0Commits the uninstall by removing stashed files.N(RutitemstcleanupRv(RwRoR|((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pytcommits	cC@sùx!|jD]}tjd|Œq
WxÄ|jD]¹\}}ywtjd||ƒtjj|ƒsttjj|ƒr„tj|ƒntjj	|ƒr£t
|ƒnt||ƒWq.tk
ræ}tj
d|ƒtjd|ƒq.Xq.W|jƒdS(s2Undoes the uninstall by moving stashed files back.sMoving to %s
 from %ssReplacing %s from %ssFailed to restore %ss
Exception: %sN(RvtloggertinfotdebugRR RiR†tunlinkR…RRR{terrorR(RwRPR‰R tex((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pytrollback&s$
cC@s
t|jƒS(N(tboolRv(Rw((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pytcan_rollback:s(t__name__t
__module__t__doc__RxR}R„RŠRR”tpropertyR–(((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pyRtÑs							tUninstallPathSetcB@skeZdZd„Zd„Zd„Zd„Zeed„Zd„Z	d„Z
d„Zed	„ƒZ
RS(
sMA set of file paths to be removed in the uninstallation of a
    requirement.cC@s:tƒ|_tƒ|_i|_||_tƒ|_dS(N(R*RKt_refusetpthR#Rtt_moved_paths(RwR#((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pyRxCs
		cC@s
t|ƒS(ss
        Return True if the given path is one we are permitted to
        remove/modify, False otherwise.

        (R(RwR ((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pyt
_permittedKscC@sÃtjj|ƒ\}}tjjt|ƒtjj|ƒƒ}tjj|ƒsUdS|j|ƒrw|jj	|ƒn|j
j	|ƒtjj|ƒddkr¿tr¿|j	t
|ƒƒndS(Nis.py(RR R;R!RROtexistsRŸRKR+RœtsplitextRR(RwR R‚ttail((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pyR+Ts'"cC@skt|ƒ}|j|ƒrW||jkr@t|ƒ|j|<n|j|j|ƒn|jj|ƒdS(N(RRŸRtUninstallPthEntriesR+Rœ(Rwtpth_filetentry((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pytadd_pthhsc	C@sÿ|js#tjd|jjƒdS|jjd|jj}tjd|ƒtƒ£|sl|j|ƒrõ|j}t	|jƒ}x7t
t|ƒƒD]#}|j|ƒtj
d|ƒq—Wx!|jjƒD]}|jƒqÎWtjd|ƒnWdQXdS(s[Remove paths in ``self.paths`` with confirmation (unless
        ``auto_confirm`` is True).s7Can't uninstall '%s'. No files were found to uninstall.Nt-sUninstalling %s:sRemoving file or directory %ssSuccessfully uninstalled %s(RKRŽRR#tproject_nametversionRt_allowed_to_proceedRžRgRIRNRŠRRRYtremove(Rwtauto_confirmtverbosetdist_name_versiontmovedt
for_renameR R((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pyR«rs"	

	
cC@s›d„}|s't|jƒ\}}nt|jƒ}tƒ}|d|ƒ|d|ƒ|d|jƒ|rˆ|dt|jƒƒntdd	ƒdkS(
sIDisplay which files would be deleted and prompt for confirmation
        cS@sU|s
dStj|ƒtƒ/x'tt|ƒƒD]}tj|ƒq4WWdQXdS(N(RŽRRRIRN(tmsgRKR ((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pyt_display—s

s
Would remove:s+Would not remove (might be manually added):s%Would not remove (outside of prefix):sWill actually move:sProceed (y/n)? tytn(R³R´(RsRKR*RœRgR
(RwR­R²RjRk((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pyRª’s	
	

cC@sq|jjs&tjd|jjƒdStjd|jjƒ|jjƒx!|jj	ƒD]}|jƒqYWdS(s1Rollback the changes previously made by remove().s'Can't roll back %s; was not uninstalledNsRolling back uninstall of %s(
RžR–RŽR’R#R¨RR”RRY(RwR((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pyR”±s

cC@s|jjƒdS(s?Remove temporary save dir: rollback will no longer be possible.N(RžR(Rw((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pyR¿scC@st|jƒ}t|ƒsAtjd|j|tjƒ||ƒS|d„tj	dƒtj	dƒhDƒkrtjd|j|ƒ||ƒS||ƒ}t
|ƒ}djtj
|jƒƒ}|joÝtjj|jƒ}t|jddƒ}|rl|jjdƒrl|jj|ƒrl|j|jƒ|jd	ƒr“x'|jd	ƒjƒD]7}tjjtjj|j|ƒƒ}	|j|	ƒqUWqØ|jd
ƒrØ|jdƒrÃ|jdƒ}
ng}
xg|jd
ƒjƒD]}|râ||
krâ|^qâD]^}tjj|j|ƒ}	|j|	ƒ|j|	dƒ|j|	d
ƒ|j|	dƒqWqØnl|rtdj|jƒƒ‚nK|jjdƒr|j|jƒtjj|jƒd}
tjjtjj|jƒdƒ}|j |d|
ƒnÕ|rB|jjdƒrBxºt!|ƒD]}	|j|	ƒq(Wn–|rÂt"|dƒ%}tjj#|j$ƒj%ƒƒ}WdQX|j|ƒtjjtjj|ƒdƒ}|j ||jƒntj&d||jƒ|jdƒrs|j'dƒrsxz|j(dƒD]f}t)|ƒr!t*}nt+}|jtjj||ƒƒt,r|jtjj||ƒdƒqqWng}|j-ddƒ}x-|j.ƒD]}|j/t0||t1ƒƒq˜W|j-ddƒ}x-|j.ƒD]}|j/t0||t2ƒƒqÚWx|D]}|j|ƒqW|S(Ns1Not uninstalling %s at %s, outside environment %scS@sh|]}|r|’qS(((RFRP((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pys	<setcomp>Ñs	tstdlibt
platstdlibs<Not uninstalling %s at %s, as it is in the standard library.s{}.egg-infoR s	.egg-infosinstalled-files.txts
top_level.txtsnamespace_packages.txts.pys.pycs.pyos©Cannot uninstall {!r}. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.s.eggiseasy-install.pths./s
.dist-infoR<s)Not sure how to uninstall: %s - Check: %stscriptss.battgrouptconsole_scriptstgui_scripts(3RR9RRŽRRAtsystprefixt	sysconfigtget_pathR
tformatRtto_filenameR¨tegg_infoRR R tgetattrt	_providerR~R:R+thas_metadatatget_metadatat
splitlinestnormpathR!RR;RVR¦R@topenROtreadlinetstripRtmetadata_isdirtmetadata_listdirRRRRt
get_entry_maptkeystextendR)tFalsetTrue(tclsR#t	dist_pathR(tdevelop_egg_linktdevelop_egg_link_egg_infotegg_info_existstdistutils_egg_infotinstalled_fileR t
namespacesRPt
top_level_pkgteasy_install_eggteasy_install_pthtfhtlink_pointertscriptR&t_scripts_to_removeR¹tnameRºts((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pyt	from_distÄs¨


		"
	$
	
	*
(R—R˜R™RxRŸR+R¦RÐR«RªR”RtclassmethodRã(((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pyR›@s					
 			R£cB@s,eZd„Zd„Zd„Zd„ZRS(cC@s"||_tƒ|_d|_dS(N(tfileR*tentriesR~t_saved_lines(RwR¤((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pyRxJs	cC@sXtjj|ƒ}trDtjj|ƒdrD|jddƒ}n|jj|ƒdS(Nis\t/(RR RORt
splitdrivetreplaceRæR+(RwR¥((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pyR+Ps
cC@sWtjd|jƒtjj|jƒs?tjd|jƒdSt|jdƒ}|jƒ}||_	WdQXt
d„|DƒƒrŽd}nd}|rÕ|dj|jdƒƒrÕ|d|jdƒ|d<nxS|j
D]H}y.tjd	|ƒ|j||jdƒƒWqßtk
r&qßXqßWt|jd
ƒ}|j|ƒWdQXdS(NsRemoving pth entries from %s:s.Cannot remove entries from nonexistent file %strbcs@s|]}d|kVqdS(s
N((RFtline((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pys	<genexpr>nss
s
iÿÿÿÿsutf-8sRemoving entry: %stwb(RŽRRåRR RitwarningRÈt	readlinesRçRJR:tencodeRæR«t
ValueErrort
writelines(RwRÝtlinestendlineR¥((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/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 stateRí(
RçR~RŽR’RåRÐRRÈRòRÑ(RwRÝ((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pyR”~s
(R—R˜RxR+R«R”(((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pyR£Is			(=t
__future__RR6R2tloggingRR»R½tpip._vendorRtpip._internal.exceptionsRtpip._internal.locationsRRtpip._internal.utils.compatRRRtpip._internal.utils.loggingRtpip._internal.utils.miscR	R
RRR
RRRRtpip._internal.utils.temp_dirRRtpip._internal.utils.typingRttypingRRRRRRRRRtpip._vendor.pkg_resourcesRt	getLoggerR—RŽR)R4R@RNRgRstobjectRtR›R£(((sP/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/req/req_uninstall.pyt<module>s8@@		
		(	3oÿ
Back to Directory File Manager