ó â\e[c@@svddlmZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z m Z m Z ddlmZddlmZmZddlmZddlmZmZmZmZmZmZmZmZdd lmZej e!ƒZ"d „Z#d „Z$e$d „ƒZ%d „Z&d„Z'de(fd„ƒYZ)de(fd„ƒYZ*dS(i(tabsolute_importN(t pkg_resources(tWINDOWStcache_from_sourcet uses_pycache(tUninstallationError(tbin_pytbin_user(t indent_log(tFakeFiletasktdist_in_usersitet dist_is_localt egg_link_pathtis_localtnormalize_pathtrenames(t TempDirectorycC@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(R RRtostpathtjoinRtappend(tdistt script_nametis_guitbin_dirtexe_nametpaths_to_remove((s>/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_uninstall.pyt _script_namess   c@s"tjˆƒ‡fd†ƒ}|S(Nc?@sHtƒ}x8ˆ||ŽD]'}||kr|j|ƒ|VqqWdS(N(tsettadd(targstkwtseentitem(tfn(s>/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_uninstall.pytunique/s    (t functoolstwraps(R#R$((R#s>/tmp/pip-install-0xiv62/pip/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_linesRRRtlocationtendswithtsplit(RtrtrowRtdnR#tbase((s>/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_uninstall.pytuninstallation_paths9s   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(Rtsep(s>/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_uninstall.pys Zs(RRR;RtsortedR8tanyR(tpathst short_pathst should_add((RR;s>/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_uninstall.pytcompactPs   c C@sdt|ƒ}tƒ}tƒ}tƒ}xg|D]_}|jdƒrIq.n|jdƒsdd|kr€|jtjj|ƒƒn|j|ƒq.Wt|ƒ}x¦|D]ž}x•tj|ƒD]„\}}} xr| D]j} | jdƒrëqÐntjj tjj || ƒƒ} tjj | ƒrÐ| |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(R5(RRR(R9tfolder((s>/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_uninstall.pys ‹s ( tlistRR-RRRtdirnameRAtwalktnormcaseRtisfile( R>t will_removet will_skiptfolderstfilesRRBtdirpatht_tdirfilestfnametfile_((s>/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_uninstall.pytcompress_for_output_listingcs,        !tUninstallPathSetcB@steZdZd„Zd„Zd„Zd„Zd„Zeed„Z d„Z d„Z d „Z e d „ƒZRS( sMA set of file paths to be removed in the uninstallation of a requirement.cC@sItƒ|_tƒ|_i|_||_tddƒ|_g|_dS(Ntkindt uninstall(RR>t_refusetpthRRtsave_dirt _moved_paths(tselfR((s>/tmp/pip-install-0xiv62/pip/pip/_internal/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(RYR((s>/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_uninstall.pyt _permittedœscC@sÃtjj|ƒ\}}tjjt|ƒtjj|ƒƒ}tjj|ƒsUdS|j|ƒrw|jj |ƒn|j j |ƒtjj |ƒddkr¿t r¿|j t |ƒƒndS(Nis.py(RRR.RRRFtexistsR[R>RRUtsplitextRR(RYRtheadttail((s>/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_uninstall.pyR¤s'"cC@skt|ƒ}|j|ƒrW||jkr@t|ƒ|j|/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_uninstall.pytadd_pth·s  cC@s8tjj|jjtjj|ƒdjtjjƒƒS(Ni(RRRRWt splitdrivetlstripR;(RYR((s>/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_uninstall.pyt_stashÀs cC@s|js#tjd|jjƒdS|jjd|jj}tjd|ƒtƒº|sl|j|ƒr |jj ƒxYt t |jƒƒD]B}|j |ƒ}tj d|ƒ|jj|ƒt||ƒqWx!|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(R>tloggertinfoRt project_nametversionRt_allowed_to_proceedRWtcreateR<RARftdebugRXRRRVtvaluestremove(RYt auto_confirmtverbosetdist_name_versionRtnew_pathRV((s>/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_uninstall.pyRpÅs$    cC@s|d„}|s't|jƒ\}}nt|jƒ}tƒ}|d|ƒ|d|ƒ|d|jƒtddƒdkS( sIDisplay which files would be deleted and prompt for confirmation cS@sU|s dStj|ƒtƒ/x'tt|ƒƒD]}tj|ƒq4WWdQXdS(N(RhRiRR<RA(tmsgR>R((s>/tmp/pip-install-0xiv62/pip/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):sProceed (y/n)? tytn(RwRx(RQR>RCRRUR (RYRrRvRHRI((s>/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_uninstall.pyRlãs    cC@sª|jjdkr,tjd|jjƒtStjd|jjƒx=|j D]2}|j |ƒ}tj d|ƒt ||ƒqLWx!|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(RWRtNoneRhterrorRRjtFalseRiRXRfRnRRVRotrollback(RYRttmp_pathRV((s>/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_uninstall.pyR|þs cC@s|jjƒg|_dS(s?Remove temporary save dir: rollback will no longer be possible.N(RWtcleanupRX(RY((s>/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_uninstall.pytcommits cC@sMt|jƒ}t|ƒsAtjd|j|tjƒ||ƒS|d„tj dƒtj dƒhDƒkrtjd|j|ƒ||ƒS||ƒ}t |ƒ}dj t 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ƒqWqnš|rtdj |jƒƒ‚ny|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||jks¬t&d||j|jfƒ‚|j|ƒtjjtjj|ƒdƒ}|j ||jƒntj'd||jƒ|jdƒr¡|j(dƒr¡xz|j)dƒD]f}t*|ƒrOt+}nt,}|jtjj||ƒƒt-r4|jtjj||ƒdƒq4q4Wng}|j.ddƒ}x-|j/ƒD]}|j0t1||t2ƒƒqÆW|j.ddƒ}x-|j/ƒD]}|j0t1||t3ƒƒqWx|D]}|j|ƒq2W|S(Ns1Not uninstalling %s at %s, outside environment %scS@sh|]}|r|’qS(((R9tp((s>/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_uninstall.pys s tstdlibt platstdlibs<Not uninstalling %s at %s, as it is in the standard library.s {}.egg-infoRs .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;Egg-link %s does not match installed location of %s (at %s)s)Not sure how to uninstall: %s - Check: %stscriptss.battgrouptconsole_scriptst gui_scripts(4RR,R RhRiR4tsystprefixt sysconfigtget_pathR tformatRt to_filenameRjtegg_infoRRR\tgetattrt _providerRyR-Rt has_metadatat get_metadatat splitlinestnormpathRRR.RDRcR3topenRFtreadlinetstriptAssertionErrorRntmetadata_isdirtmetadata_listdirR RRRt get_entry_maptkeystextendRR{tTrue(tclsRt dist_pathRtdevelop_egg_linktdevelop_egg_link_egg_infotegg_info_existstdistutils_egg_infotinstalled_fileRt namespacesR€t top_level_pkgteasy_install_eggteasy_install_pthtfht link_pointertscriptRt_scripts_to_removeR…tnameR†ts((s>/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_uninstall.pyt from_dists®        "  $     * (t__name__t __module__t__doc__RZR[RRcRfR{RpRlR|Rt classmethodR¯(((s>/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_uninstall.pyRR‘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( RRRGRtfileRtentriesRyt _saved_lines(RYRa((s>/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_uninstall.pyRZ—s   cC@sXtjj|ƒ}trDtjj|ƒd rD|jddƒ}n|jj|ƒdS(Nis\t/(RRRFRRdtreplaceRµR(RYRb((s>/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_uninstall.pyR scC@s+tjd|jƒt|jdƒ}|jƒ}||_WdQXtd„|Dƒƒrbd}nd}|r©|dj|jdƒƒ r©|d|jdƒ|d/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_uninstall.pys °ss s iÿÿÿÿsutf-8sRemoving entry: %stwb( RhRnR´R”t readlinesR¶R=R-tencodeRµRpt ValueErrort writelines(RYR©tlinestendlineRb((s>/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_uninstall.pyRpª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¶RyRhRzR´R{RnR”R¿R(RYR©((s>/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_uninstall.pyR|Às (R°R±RZRRpR|(((s>/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_uninstall.pyR`–s (+t __future__RR)R%tloggingRR‡R‰t pip._vendorRtpip._internal.compatRRRtpip._internal.exceptionsRtpip._internal.locationsRRtpip._internal.utils.loggingRtpip._internal.utils.miscR R R R R RRRtpip._internal.utils.temp_dirRt getLoggerR°RhRR'R3RARQtobjectRRR`(((s>/tmp/pip-install-0xiv62/pip/pip/_internal/req/req_uninstall.pyts,      :    .ÿ