o
    ©„jœ  ã                   @  sP  d dl m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
 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m Z  d dl!m"Z" d dl#m$Z$ e %e&¡Z'd4dd„Z(d5dd„Z)d6dd„Z*d7d d!„Z+d8d#d$„Z,d9d&d'„Z-d5d(d)„Z.d:d,d-„Z/d;d0d1„Z0G d2d3„ d3eƒZ1dS )<é    )ÚannotationsN)ÚValues)Ú
ModuleType)ÚAny)Úwhere)Úparse)Ú
cmdoptions)ÚCommand)Úmake_target_python)ÚSUCCESS)ÚConfiguration)Úget_environment)Úget_locale_encodingÚopen_text_resource)Ú
indent_log)Úget_pip_versionÚnameÚstrÚvaluer   ÚreturnÚNonec                 C  s   t  d| |¡ d S )Nz%s: %s)ÚloggerÚinfo)r   r   © r   úZ/var/www/html/django_cbt/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   údict[str, str]c                  C  sN   t ddƒ�} dd„ |  ¡ D ƒ}W d   ƒ n1 sw   Y  tdd„ |D ƒƒS )Nzpip._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>/   s   € z(create_vendor_txt_map.<locals>.<genexpr>)r   Ú	readlinesÚdict)ÚfÚlinesr   r   r   Úcreate_vendor_txt_map&   s   ÿýr0   Úmodule_nameúModuleType | Nonec                 C  sB   |   ¡  dd¡} | dkrd} td| › �tƒ tƒ dd� ttj| ƒS )Nú-Ú_Ú
setuptoolsÚpkg_resourceszpip._vendor.r   )Úlevel)ÚlowerÚreplaceÚ
__import__ÚglobalsÚlocalsÚgetattrÚpipÚ_vendor)r1   r   r   r   Úget_module_from_module_name2   s
   r@   ú
str | Nonec                 C  sZ   t | ƒ}t|dd ƒ}|r+|s+|jd usJ ‚ttj |j¡gƒ}| | ¡}|r+t|j	ƒ}|S )NÚ__version__)
r@   r=   Ú__file__r   ÚosÚpathÚdirnameÚget_distributionr   Úversion)r1   ÚmodulerH   ÚenvÚdistr   r   r   Úget_vendor_version_from_module=   s   

rL   Úvendor_txt_versionsc                 C  s\   |   ¡ D ]'\}}d}t|ƒ}|sd}|}nt|ƒt|ƒkr#d|› 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)z2 (CONFLICT: vendor.txt suggests version should be ú)z%s==%s%sN)ÚitemsrL   Úparse_versionr   r   )rM   r1   Úexpected_versionÚextra_messageÚactual_versionr   r   r   Úshow_actual_vendor_versionsL   s   ÿÿÿòrU   c                  C  sD   t  d¡ tƒ } tƒ � t| ƒ W d   ƒ d S 1 sw   Y  d S )Nzvendored library versions:)r   r   r0   r   rU   )rM   r   r   r   Úshow_vendor_versionsa   s
   

"ÿrV   Úoptionsr   c           	      C  sæ   d}t | ƒ}| ¡ }| ¡ }d}|rd|› d�}dt|ƒ› |› �}t |¡ | jdk r:t|ƒ|kr:d}|d |… }nd}tƒ �* |D ]	}t t|ƒ¡ qB|rad	|› d
�}t |¡ W d   ƒ d S W d   ƒ d S 1 slw   Y  d S )Né
   rN   z
 (target: rO   zCompatible tags: r#   TFz...
[First z) tags shown. Pass --verbose to show all.])	r
   Úget_sorted_tagsÚformat_givenÚlenr   r   Úverboser   r   )	rW   Ú	tag_limitÚtarget_pythonÚtagsÚformatted_targetÚsuffixÚmsgÚtags_limitedÚtagr   r   r   Ú	show_tagsi   s,   
ú"üre   Úconfigr   c                   sX   dd„ |   ¡ D ƒ}|sdS g d¢‰ ‡ fdd„|D ƒ}|sdS d|v r'| d¡ d |¡S )	Nc                 S  s*   h | ]\}}|D ]
}|  d d¡d ’qqS )Ú.r#   r   r*   )r'   r4   rW   Úkeyr   r   r   Ú	<setcomp>ˆ   s   * z!ca_bundle_info.<locals>.<setcomp>zNot specified)ÚinstallÚwheelÚdownloadc                   s   g | ]}|ˆ v r|‘qS r   r   )r'   r7   ©Úlevels_that_override_globalr   r   r)   �   s    z"ca_bundle_info.<locals>.<listcomp>Úglobalz, )rP   ÚremoveÚjoin)rf   ÚlevelsÚglobal_overriding_levelr   rm   r   Úca_bundle_info‡   s   
ÿ

rt   c                   @  s,   e Zd ZdZdZdZddd„Zddd„ZdS )ÚDebugCommandz$
    Display debug information.
    z
      %prog <options>Tr   r   c                 C  s,   t  | j¡ | j d| j¡ | jj ¡  d S )Nr   )r   Úadd_target_python_optionsÚcmd_optsÚparserÚinsert_option_grouprf   Úload)Úselfr   r   r   Úadd_options¡   s   zDebugCommand.add_optionsrW   r   Úargsú	list[str]Úintc                 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.getencodingzsys.platformz'cert' config valueÚREQUESTS_CA_BUNDLEÚCURL_CA_BUNDLEzpip._vendor.certifi.where()zpip._vendor.DEBUNDLED)r   Úwarningr   r   r   rH   Ú
executableÚgetdefaultencodingÚgetfilesystemencodingr   Úplatformr   rt   rx   rf   rD   ÚenvironÚgetr   r>   r?   Ú	DEBUNDLEDrV   re   r   )r{   rW   r}   r   r   r   Úrun¦   s,   ÿþzDebugCommand.runN©r   r   )rW   r   r}   r~   r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚusageÚignore_require_venvr|   rŠ   r   r   r   r   ru   ˜   s    
ru   )r   r   r   r   r   r   r‹   )r   r    )r1   r   r   r2   )r1   r   r   rA   )rM   r    r   r   )rW   r   r   r   )rf   r   r   r   )2Ú
__future__r   ÚloggingrD   r   Úoptparser   Útypesr   Útypingr   Úpip._vendorr>   Úpip._vendor.certifir   Úpip._vendor.packaging.versionr   rQ   Ú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.compatr   r   Úpip._internal.utils.loggingr   Úpip._internal.utils.miscr   Ú	getLoggerrŒ   r   r   r   r0   r@   rL   rU   rV   re   rt   ru   r   r   r   r   Ú<module>   s<    









