o
    Ëý°jå  ã                   @   s   d dl Z d dlZd dlZd dlZd dlmZ d dlmZ d dlm	Z	m
Z
mZmZ d dlZd dlmZ d dlmZ d dlmZ d dlmZ d d	lmZ d d
lmZ d dlmZ d dlmZ d dl m!Z! d dl"m#Z# d dl$m%Z% e &e'¡Z(de)de	ddfdd„Z*d+dd„Z+de
e)e)f fdd„Z,de)defdd„Z-de)dee) fdd„Z.de
e)e)f ddfdd „Z/d+d!d"„Z0d#eddfd$d%„Z1d&ede)fd'd(„Z2G d)d*„ d*eƒZ3dS ),é    N)ÚValues)Ú
ModuleType)ÚAnyÚDictÚListÚOptional)Úwhere)Úparse)Ú__file__)Ú
cmdoptions)ÚCommand)Úmake_target_python)ÚSUCCESS)ÚConfiguration)Úget_environment)Ú
indent_log)Úget_pip_versionÚnameÚvalueÚreturnc                 C   s   t  d| |¡ d S )Nz%s: %s)ÚloggerÚinfo)r   r   © r   ú�/root/aizidognhua/tmp/workspace/projects/ec89d86c-575f-41c9-af57-ac45cbdbf775/venv/lib/python3.10/site-packages/pip/_internal/commands/debug.pyÚ
show_value   s   r   c                  C   sH   t  d¡ tjj} tƒ � td| ƒ W d   ƒ d S 1 sw   Y  d S )Nzsys.implementation:r   )r   r   ÚsysÚimplementationr   r   r   )Úimplementation_namer   r   r   Úshow_sys_implementation   s
   
"ÿr   c                  C   sd   t j t j t¡dd¡} t| ƒ�}dd„ | ¡ D ƒ}W d   ƒ n1 s$w   Y  tdd„ |D ƒƒS )NÚ_vendorz
vendor.txtc                 S   s(   g | ]}d |v r|  ¡  dd¡d ‘qS )ú==ú é   r   )ÚstripÚsplit©Ú.0Úliner   r   r   Ú
<listcomp>-   s    "z)create_vendor_txt_map.<locals>.<listcomp>c                 s   s   � | ]	}|  d d¡V  qdS )r    r"   N)r$   r%   r   r   r   Ú	<genexpr>2   s   € z(create_vendor_txt_map.<locals>.<genexpr>)ÚosÚpathÚjoinÚdirnameÚpip_locationÚopenÚ	readlinesÚdict)Úvendor_txt_pathÚfÚlinesr   r   r   Úcreate_vendor_txt_map%   s   ÿ
ÿýr5   Úmodule_namec                 C   s:   |   ¡ } | dkr
d} td| › �tƒ tƒ dd� ttj| ƒS )NÚ
setuptoolsÚpkg_resourceszpip._vendor.r   )Úlevel)ÚlowerÚ
__import__ÚglobalsÚlocalsÚgetattrÚpipr   )r6   r   r   r   Úget_module_from_module_name5   s
   r@   c                 C   sH   t | ƒ}t|dd ƒ}|s"ttj |j¡gƒ}| | ¡}|r"t|j	ƒ}|S )NÚ__version__)
r@   r>   r   r*   r+   r-   r
   Úget_distributionÚstrÚversion)r6   ÚmodulerD   ÚenvÚdistr   r   r   Úget_vendor_version_from_module@   s   

rH   Úvendor_txt_versionsc                 C   sZ   |   ¡ D ]&\}}d}t|ƒ}|sd}|}nt|ƒt|ƒkr"d |¡}t d|||¡ qdS )z{Log the actual version and print extra info if there is
    a conflict or if the actual version could not be imported.
    Ú zM (Unable to locate actual module version, using vendor.txt specified version)z5 (CONFLICT: vendor.txt suggests version should be {})z%s==%s%sN)ÚitemsrH   Úparse_versionÚformatr   r   )rI   r6   Úexpected_versionÚextra_messageÚactual_versionr   r   r   Úshow_actual_vendor_versionsN   s   ÿþòrQ   c                  C   sD   t  d¡ tƒ } tƒ � t| ƒ W d   ƒ d S 1 sw   Y  d S )Nzvendored library versions:)r   r   r5   r   rQ   )rI   r   r   r   Úshow_vendor_versionsc   s
   

"ÿrR   Úoptionsc           	      C   sä   d}t | ƒ}| ¡ }| ¡ }d}|rd|› d�}d t|ƒ|¡}t |¡ | jdk r9t|ƒ|kr9d}|d |… }nd}tƒ �* |D ]	}t t	|ƒ¡ qA|r`d	j|d
�}t |¡ W d   ƒ d S W d   ƒ d S 1 skw   Y  d S )Né
   rJ   z
 (target: ú)zCompatible tags: {}{}r"   TFz?...
[First {tag_limit} tags shown. Pass --verbose to show all.])Ú	tag_limit)
r   Úget_tagsÚformat_givenrM   Úlenr   r   Úverboser   rC   )	rS   rV   Útarget_pythonÚtagsÚformatted_targetÚsuffixÚmsgÚtags_limitedÚtagr   r   r   Ú	show_tagsk   s0   
þø"ürb   Úconfigc                    sr   t ƒ }|  ¡ D ]\}}| | d¡d ¡ q|sdS g d¢‰ ‡ fdd„|D ƒ}|s+dS d|v r4| d¡ d |¡S )	NÚ.r   zNot specified)ÚinstallÚwheelÚdownloadc                    s   g | ]}|ˆ v r|‘qS r   r   )r&   r9   ©Úlevels_that_override_globalr   r   r(   ”   s    z"ca_bundle_info.<locals>.<listcomp>Úglobalz, )ÚsetrK   Úaddr$   Úremover,   )rc   ÚlevelsÚkeyÚ_Úglobal_overriding_levelr   rh   r   Úca_bundle_info‹   s   
ÿ

rr   c                   @   s<   e Zd ZdZdZdZddd„Zded	ee	 de
fd
d„ZdS )ÚDebugCommandz$
    Display debug information.
    z
      %prog <options>Tr   Nc                 C   s,   t  | j¡ | j d| j¡ | jj ¡  d S )Nr   )r   Úadd_target_python_optionsÚcmd_optsÚparserÚinsert_option_grouprc   Úload)Úselfr   r   r   Úadd_options¨   s   zDebugCommand.add_optionsrS   Úargsc                 C   sÌ   t  d¡ tdtƒ ƒ tdtjƒ tdtjƒ tdt ¡ ƒ tdt ¡ ƒ tdt	 
¡ ƒ tdtjƒ tƒ  td	t| jjƒƒ td
tj d
¡ƒ tdtj d¡ƒ tdtƒ ƒ tdtjjƒ tƒ  t|ƒ tS )Nz¸This command is only meant for debugging. Do not use this with automation for parsing and getting these details, since the output and options of this command may change without notice.zpip versionzsys.versionzsys.executablezsys.getdefaultencodingzsys.getfilesystemencodingzlocale.getpreferredencodingzsys.platformz'cert' config valueÚREQUESTS_CA_BUNDLEÚCURL_CA_BUNDLEzpip._vendor.certifi.where()zpip._vendor.DEBUNDLED)r   Úwarningr   r   r   rD   Ú
executableÚgetdefaultencodingÚgetfilesystemencodingÚlocaleÚgetpreferredencodingÚplatformr   rr   rv   rc   r*   ÚenvironÚgetr   r?   r   Ú	DEBUNDLEDrR   rb   r   )ry   rS   r{   r   r   r   Úrun­   s,   ÿþzDebugCommand.run©r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚusageÚignore_require_venvrz   r   r   rC   Úintrˆ   r   r   r   r   rs   Ÿ   s    
rs   r‰   )4r‚   Úloggingr*   r   Úoptparser   Útypesr   Útypingr   r   r   r   Úpip._vendorr?   Úpip._vendor.certifir   Úpip._vendor.packaging.versionr	   rL   r
   r.   Úpip._internal.clir   Úpip._internal.cli.base_commandr   Úpip._internal.cli.cmdoptionsr   Úpip._internal.cli.status_codesr   Úpip._internal.configurationr   Úpip._internal.metadatar   Úpip._internal.utils.loggingr   Úpip._internal.utils.miscr   Ú	getLoggerrŠ   r   rC   r   r   r5   r@   rH   rQ   rR   rb   rr   rs   r   r   r   r   Ú<module>   s<    


 