JFIF$        dd7 

Viewing File: /usr/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_uninstall.cpython-39.pyc

a

[��f�\�@s�ddlZddlZddlZddlZddlZddlmZddlmZm	Z	m
Z
mZmZm
Z
mZmZmZddlmZddlmZddlmZddlmZmZddlmZdd	lmZdd
lmZm Z ddl!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(ddl)m*Z*m+Z+ee,�Z-ee.e/e
e.d
�dd�Z0e	deefe	deefd�dd�Z1e1eee.d�dd��Z2ee.ee.d�dd�Z3ee.ee.d�dd�Z4ee.eee.ee.fd�dd�Z5Gdd�d�Z6Gd d!�d!�Z7Gd"d#�d#�Z8dS)$�N)�cache_from_source)	�Any�Callable�Dict�Iterable�Iterator�List�Optional�Set�Tuple)�
pkg_resources)�Distribution)�UninstallationError)�get_bin_prefix�get_bin_user)�WINDOWS)�egg_link_path_from_location)�	getLogger�
indent_log)�ask�dist_in_usersite�
dist_is_local�is_local�normalize_path�renames�rmtree)�AdjacentTempDirectory�
TempDirectory)�dist�script_name�is_gui�returncCspt|�rt�}nt�}tj�||�}|g}trl|�|d�|�|d�|r^|�|d�n|�|d�|S)z�Create the fully qualified name of the files created by
    {console,gui}_scripts for the given ``dist``.
    Returns the list of file names
    z.exez
.exe.manifestz-script.pywz
-script.py)rrr�os�path�joinr�append)rrr �bin_dirZexe_name�paths_to_remove�r(�C/usr/lib/python3.9/site-packages/pip/_internal/req/req_uninstall.py�
_script_namessr*.)�fnr!cs(t���ttttd��fdd��}|S)N)�args�kwr!c?s6t�}�|i|��D]}||vr|�|�|VqdS�N)�set�add)r,r-�seen�item�r+r(r)�unique5s

z_unique.<locals>.unique)�	functools�wrapsrr)r+r4r(r3r)�_unique4sr7�rr!c
cs8zt�|�d��}Wn�ty�}z�dj|d�}z$t|�d��}|rL|dkrRt��Wn6tttfy�d�|j	|j
�}|d�|�7}Yn0|d�|�7}t|�|�WYd	}~n
d	}~00|D]t}tj
�|j|d
�}|V|�d�r�tj
�|�\}}	|	d	d�}
tj
�||
d
�}|Vtj
�||
d�}|Vq�d	S)a�
    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].

    If RECORD is not found, raises UninstallationError,
    with possible information from the INSTALLER file.

    https://packaging.python.org/specifications/recording-installed-packages/
    ZRECORDz/Cannot uninstall {dist}, RECORD file not found.)rZ	INSTALLERZpipz{}=={}zZ You might be able to recover from this via: 'pip install --force-reinstall --no-deps {}'.z' Hint: The package was installed by {}.Nr�.py����.pyc�.pyo)�csv�readerZget_metadata_lines�FileNotFoundError�format�next�
ValueError�OSError�
StopIteration�project_name�versionrr"r#r$�location�endswith�split)r�rZmissing_record_exception�msgZ	installerZdep�rowr#Zdnr+�baser(r(r)�uninstallation_paths@s6
��
 
rN)�pathsr!csJtjj�t�}t|td�D]*�t��fdd�|D��}|s|���q|S)z�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.��keyc3s:|]2}��|�d��o0�t|�d������kVqdS)�*N)�
startswith�rstrip�len)�.0Z	shortpath�r#�sepr(r)�	<genexpr>us�zcompact.<locals>.<genexpr>)r"r#rXr/�sortedrU�anyr0)rOZshort_pathsZshould_skipr(rWr)�compactls�r\c	s�dd�|D�}t|�}tdd�|��D�td�}t�}ttd�dd��|D]��t�fd	d
�|D��rfqJt�}t�}t���D]B\�}}|����fdd
�|D��|����fdd
�|D��q|||sJ|�	|�|�
�tj�qJtt|j
|��|BS)
z�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.
    cSsi|]}tj�|�|�qSr()r"r#�normcase�rV�pr(r(r)�
<dictcomp>��z'compress_for_rename.<locals>.<dictcomp>cSsh|]}tj�|�d�qS)r)r"r#rIr^r(r(r)�	<setcomp>�raz&compress_for_rename.<locals>.<setcomp>rP)�ar!cWstj�tjj|��Sr.)r"r#r]r$)rcr(r(r)�	norm_join�sz&compress_for_rename.<locals>.norm_joinc3s |]}tj����|�VqdSr.)r"r#r]rS)rV�w)�rootr(r)rY�raz&compress_for_rename.<locals>.<genexpr>c3s|]}���|�VqdSr.r()rV�d��dirnamerdrfr(r)rY�rac3s|]}���|�VqdSr.r()rV�frhr(r)rY�ra)r/rZ�valuesrU�strr[r"�walk�update�difference_updater0rX�map�__getitem__)	rOZcase_mapZ	remainingZ	uncheckedZ	wildcardsZ	all_filesZall_subdirs�subdirs�filesr(rhr)�compress_for_renames"
rtc
Cs�t|�}t�}t�}t�}|D]>}|�d�r.q|�d�s@d|vrR|�tj�|��|�|�qtttjj|��}t|�}|D]d}t�	|�D]T\}}	}
|
D]D}|�d�r�q�tj�
||�}tj�|�r�tj�|�|vr�|�|�q�q�q||dd�|D�B}||fS)asReturns 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.
    r;z__init__.py�
.dist-infocSsh|]}tj�|d��qS)rR)r"r#r$)rV�folderr(r(r)rb�raz.compress_for_output_listing.<locals>.<setcomp>)r/rHr0r"r#rirpr]r\rmr$�isfile)
rO�will_remove�	will_skipZfoldersrsr#Z_normcased_filesrv�dirpath�_Zdirfiles�fnameZfile_r(r(r)�compress_for_output_listing�s2


��r}c@s|eZdZdZdd�dd�Zeed�dd�Zeed�d	d
�Zeed�dd�Zdd�d
d�Z	dd�dd�Z
eed�dd��Z
dS)�StashedUninstallPathSetzWA set of file rename operations to stash files while
    tentatively uninstalling them.N�r!cCsi|_g|_dSr.)�
_save_dirs�_moves��selfr(r(r)�__init__�sz StashedUninstallPathSet.__init__�r#r!cCsBzt|�}Wnty(tdd�}Yn0||jtj�|�<|jS)z�Stashes a directory.

        Directories are stashed adjacent to their original location if
        possible, or else moved/copied into the user's temp dir.�	uninstall��kind)rrCrr�r"r#r])r�r#�save_dirr(r(r)�_get_directory_stash�sz,StashedUninstallPathSet._get_directory_stashcCs�tj�|�}tj�|�d}}d}||krdz|j|}Wq�WntyNYn0tj�|�|}}q"tj�|�}tdd�}||j|<tj�||�}|r�|tjjkr�tj�	|j|�S|jS)z�Stashes a file.

        If no root has been provided, one will be created for the directory
        in the user's temp directory.Nr�r�)
r"r#r]rir��KeyErrorr�relpath�curdirr$)r�r#�headZold_headr�r�r(r(r)�_get_file_stash�s"


z'StashedUninstallPathSet._get_file_stashcCsltj�|�otj�|�}|r*|�|�}n
|�|�}|j�||f�|r^tj�|�r^t�|�t	||�|S)z�Stashes the directory or file and returns its new location.
        Handle symlinks as files to avoid modifying the symlink targets.
        )
r"r#�isdir�islinkr�r�r�r%�rmdirr)r�r#Zpath_is_dir�new_pathr(r(r)�stashs


zStashedUninstallPathSet.stashcCs,|j��D]\}}|��q
g|_i|_dS)z0Commits the uninstall by removing stashed files.N)r��itemsZcleanupr�)r�r{r�r(r(r)�commits
zStashedUninstallPathSet.commitcCs�|jD]}tjdg|�R�q|jD]�\}}zTt�d||�tj�|�sTtj�|�r`t�|�ntj�	|�rtt
|�t||�Wq$ty�}z$t�
d|�t�d|�WYd}~q$d}~00q$|��dS)z2Undoes the uninstall by moving stashed files back.zMoving to %s
 from %szReplacing %s from %szFailed to restore %sz
Exception: %sN)r��logger�info�debugr"r#rwr��unlinkr�rrrC�errorr�)r�r_r�r#�exr(r(r)�rollback$s
$z StashedUninstallPathSet.rollbackcCs
t|j�Sr.)�boolr�r�r(r(r)�can_rollback7sz$StashedUninstallPathSet.can_rollback)�__name__�
__module__�__qualname__�__doc__r�rlr�r�r�r�r��propertyr�r�r(r(r(r)r~�sr~c@s�eZdZdZedd�dd�Zeed�dd�Zedd�d	d
�Z	eedd�dd
�Z
deedd�dd�Zeed�dd�Zdd�dd�Z
dd�dd�Zeedd�dd��ZdS)�UninstallPathSetzMA set of file paths to be removed in the uninstallation of a
    requirement.Nr8cCs(t�|_t�|_i|_||_t�|_dSr.)r/rO�_refuse�pthrr~�_moved_paths)r�rr(r(r)r�@s
zUninstallPathSet.__init__r�cCst|�S)zs
        Return True if the given path is one we are permitted to
        remove/modify, False otherwise.

        )r)r�r#r(r(r)�
_permittedGszUninstallPathSet._permittedcCs�tj�|�\}}tj�t|�tj�|��}tj�|�s:dS|�|�rR|j�	|�n|j
�	|�tj�|�ddkr�|�	t|��dS)N�r9)
r"r#rIr$rr]�existsr�rOr0r��splitextr)r�r#r��tailr(r(r)r0Os
zUninstallPathSet.add)�pth_file�entryr!cCsLt|�}|�|�r<||jvr*t|�|j|<|j|�|�n|j�|�dSr.)rr�r��UninstallPthEntriesr0r�)r�r�r�r(r(r)�add_pthbs

zUninstallPathSet.add_pthF)�auto_confirm�verboser!cCs�|jst�d|jj�dS|jjd|jj}t�d|�t��z|sP|�|�r�|j}t	|j�}t
t|��D]}|�|�t�
d|�ql|j��D]}|��q�t�d|�Wd�n1s�0YdS)z[Remove paths in ``self.paths`` with confirmation (unless
        ``auto_confirm`` is True).z7Can't uninstall '%s'. No files were found to uninstall.N�-zUninstalling %s:zRemoving file or directory %szSuccessfully uninstalled %s)rOr�r�rrErFr�_allowed_to_proceedr�rtrZr\r�r�r�rk�remove)r�r�r�Zdist_name_versionZmovedZ
for_renamer#r�r(r(r)r�ks$�


zUninstallPathSet.remove)r�r!cCs|tttdd�dd�}|s*t|j�\}}nt|j�}t�}|d|�|d|�|d|j�|rn|dt|j��td	d
�dkS)z@Display which files would be deleted and prompt for confirmationN)rKrOr!cSsX|sdSt�|�t��,tt|��D]}t�|�q&Wd�n1sJ0YdSr.)r�r�rrZr\)rKrOr#r(r(r)�_display�s
z6UninstallPathSet._allowed_to_proceed.<locals>._displayz
Would remove:z+Would not remove (might be manually added):z%Would not remove (outside of prefix):zWill actually move:zProceed (Y/n)? )�y�n�r�)rlrr}rOr/r�rtr)r�r�r�rxryr(r(r)r��s	


z$UninstallPathSet._allowed_to_proceedrcCsR|jjst�d|jj�dSt�d|jj�|j��|j�	�D]}|��q@dS)z1Rollback the changes previously made by remove().z'Can't roll back %s; was not uninstalledNzRolling back uninstall of %s)
r�r�r�r�rrEr�r�r�rk)r�r�r(r(r)r��s�
zUninstallPathSet.rollbackcCs|j��dS)z?Remove temporary save dir: rollback will no longer be possible.N)r�r�r�r(r(r)r��szUninstallPathSet.commitcs�t|j�}t|�s.t�d|j|tj�||�S|dd�t�	d�t�	d�hD�vrht�d|j|�||�S||�}t
|j�}d�t
�|j��}|jo�tj�|j�}t|jdd�}|�r�|j�d	��r�|j�|��s�|�|j�|�d
��r |�d
���D]&}tj�tj�|j|��}	|�|	�q�n�|�d��r�|�d��rD|�d��ng��fd
d�|�d���D�D]J}
tj�|j|
�}	|�|	�|�|	d�|�|	d�|�|	d��qd�nF|�r�td�|j����n,|j�d��r$|�|j�tj�|j�d}tj�tj�|j�d�}|�|d|�n�|�rT|j�d��rTt |�D]}	|�|	��q@n�|�r�t!|��$}
tj�"|
�#��$��}Wd�n1�s�0Y||jk�s�Jd�||j|j���|�|�tj�tj�|�d�}|�||j�nt�%d||j�|�d��rn|�&d��rn|�'d�D]P}t(|��r2t)�}nt*�}|�tj�||��t+�r|�tj�||�d��qg}|j,dd�}|�-�D]}|�.t/||d���q�|j,dd�}|�-�D]}|�.t/||d ���q�|D]}|�|��q�|S)!Nz1Not uninstalling %s at %s, outside environment %scSsh|]}|r|�qSr(r(r^r(r(r)rb�s�z-UninstallPathSet.from_dist.<locals>.<setcomp>ZstdlibZ
platstdlibz<Not uninstalling %s at %s, as it is in the standard library.z{}.egg-infor#z	.egg-infozinstalled-files.txtz
top_level.txtznamespace_packages.txtcsg|]}|r|�vr|�qSr(r(r^�Z
namespacesr(r)�
<listcomp>�s�z.UninstallPathSet.from_dist.<locals>.<listcomp>r9r;r<z�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.z.eggr�zeasy-install.pthz./ruz;Egg-link {} does not match installed location of {} (at {})z)Not sure how to uninstall: %s - Check: %sZscriptsz.bat�console_scripts)�groupF�gui_scriptsT)0rrGrr�r�rQ�sys�prefix�	sysconfigZget_pathrrEr@rZto_filenameZegg_infor"r#r��getattrZ	_providerrHr0Zhas_metadataZget_metadata�
splitlines�normpathr$rrIrir�rN�openr]�readline�stripr�Zmetadata_isdirZmetadata_listdirrrrrZ
get_entry_map�keys�extendr*)�clsrZ	dist_pathr'Zdevelop_egg_linkZdevelop_egg_link_egg_infoZegg_info_existsZdistutils_egg_infoZinstalled_filer#Z
top_level_pkgZeasy_install_eggZeasy_install_pth�fhZlink_pointerZscriptr&Z_scripts_to_remover��namer��sr(r�r)�	from_dist�s�
���

��
�
��
�

���
4�
��
��
zUninstallPathSet.from_dist)FF)r�r�r�r�r
r�rlr�r�r0r�r�r�r�r��classmethodr�r(r(r(r)r�<s	
r�c@sHeZdZedd�dd�Zedd�dd�Zdd�d	d
�Zed�dd�ZdS)
r�N)r�r!cCs||_t�|_d|_dSr.)�filer/�entries�_saved_lines)r�r�r(r(r)r�CszUninstallPthEntries.__init__)r�r!cCs<tj�|�}tr,tj�|�ds,|�dd�}|j�|�dS)Nr�\�/)r"r#r]r�
splitdrive�replacer�r0)r�r�r(r(r)r0Hs
zUninstallPthEntries.addrc	Cs2t�d|j�tj�|j�s.t�d|j�dSt|jd��}|��}||_	Wd�n1s^0Yt
dd�|D��r�d}nd}|r�|d�|�d	��s�|d|�d	�|d<|j
D]<}z$t�d
|�|�||�d	��Wq�ty�Yq�0q�t|jd��}|�|�Wd�n1�s$0YdS)NzRemoving pth entries from %s:z.Cannot remove entries from nonexistent file %s�rbcss|]}d|vVqdS)s
Nr()rV�liner(r(r)rYbraz-UninstallPthEntries.remove.<locals>.<genexpr>z
�
���zutf-8zRemoving entry: %s�wb)r�r�r�r"r#rwZwarningr��	readlinesr�r[rH�encoder�r�rB�
writelines)r�r��linesZendliner�r(r(r)r�Ws($
zUninstallPthEntries.removecCsf|jdurt�d|j�dSt�d|j�t|jd��}|�|j�Wd�n1sX0YdS)Nz.Cannot roll back changes to %s, none were madeFz!Rolling %s back to previous stater�T)r�r�r�r�r�r�r�)r�r�r(r(r)r�rs
*zUninstallPthEntries.rollback)	r�r�r�rlr�r0r�r�r�r(r(r(r)r�Bsr�)9r=r5r"r�r��importlib.utilr�typingrrrrrrr	r
rZpip._vendorrZpip._vendor.pkg_resourcesr
Zpip._internal.exceptionsrZpip._internal.locationsrrZpip._internal.utils.compatrZpip._internal.utils.egg_linkrZpip._internal.utils.loggingrrZpip._internal.utils.miscrrrrrrrZpip._internal.utils.temp_dirrrr�r�rlr�r*r7rNr\rtr}r~r�r�r(r(r(r)�<module>s8,$	(+"$2i
Back to Directory  nL+D550H?Mx ,D"v]qv;6*Zqn)ZP0!1 A "#a$2Qr D8 a Ri[f\mIykIw0cuFcRı?lO7к_f˓[C$殷WF<_W ԣsKcëIzyQy/_LKℂ;C",pFA:/]=H  ~,ls/9ć:[=/#f;)x{ٛEQ )~ =𘙲r*2~ a _V=' kumFD}KYYC)({ *g&f`툪ry`=^cJ.I](*`wq1dđ#̩͑0;H]u搂@:~וKL Nsh}OIR*8:2 !lDJVo(3=M(zȰ+i*NAr6KnSl)!JJӁ* %݉?|D}d5:eP0R;{$X'xF@.ÊB {,WJuQɲRI;9QE琯62fT.DUJ;*cP A\ILNj!J۱+O\͔]ޒS߼Jȧc%ANolՎprULZԛerE2=XDXgVQeӓk yP7U*omQIs,K`)6\G3t?pgjrmۛجwluGtfh9uyP0D;Uڽ"OXlif$)&|ML0Zrm1[HXPlPR0'G=i2N+0e2]]9VTPO׮7h(F*癈'=QVZDF,d߬~TX G[`le69CR(!S2!P <0x<!1AQ "Raq02Br#SCTb ?Ζ"]mH5WR7k.ۛ!}Q~+yԏz|@T20S~Kek *zFf^2X*(@8r?CIuI|֓>^ExLgNUY+{.RѪ τV׸YTD I62'8Y27'\TP.6d&˦@Vqi|8-OΕ]ʔ U=TL8=;6c| !qfF3aů&~$l}'NWUs$Uk^SV:U# 6w++s&r+nڐ{@29 gL u"TÙM=6(^"7r}=6YݾlCuhquympǦ GjhsǜNlɻ}o7#S6aw4!OSrD57%|?x>L |/nD6?/8w#[)L7+6〼T ATg!%5MmZ/c-{1_Je"|^$'O&ޱմTrb$w)R$& N1EtdU3Uȉ1pM"N*(DNyd96.(jQ)X 5cQɎMyW?Q*!R>6=7)Xj5`J]e8%t!+'!1Q5 !1 AQaqё#2"0BRb?Gt^## .llQT $v,,m㵜5ubV =sY+@d{N! dnO<.-B;_wJt6;QJd.Qc%p{ 1,sNDdFHI0ГoXшe黅XۢF:)[FGXƹ/w_cMeD,ʡcc.WDtA$j@:) -# u c1<@ۗ9F)KJ-hpP]_x[qBlbpʖw q"LFGdƶ*s+ډ_Zc"?%t[IP 6J]#=ɺVvvCGsGh1 >)6|ey?Lӣm,4GWUi`]uJVoVDG< SB6ϏQ@ TiUlyOU0kfV~~}SZ@*WUUi##; s/[=!7}"WN]'(L! ~y5g9T̅JkbM' +s:S +B)v@Mj e Cf jE 0Y\QnzG1д~Wo{T9?`Rmyhsy3!HAD]mc1~2LSu7xT;j$`}4->L#vzŏILS ֭T{rjGKC;bpU=-`BsK.SFw4Mq]ZdHS0)tLg