HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/pip/_internal/operations/install/__pycache__/wheel.cpython-310.pyc
o

@%Nek�@sdZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
mZddlmZddlmZmZmZddlmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%ddl&m'Z'm(Z(ddl)m*Z*dd	l+m,Z,dd
l-m.Z.ddl/m0Z0ddl1m2Z2dd
l3m4Z4m5Z5m6Z6ddl7m8Z8m9Z9ddl:m;Z;m<Z<ddl=m>Z>m?Z?ddl@mAZAmBZBmCZCmDZDddlEmFZFmGZGmHZHmIZIddlJmKZKer�ddlmLZLGdd�deL�ZMe�NeO�ZPedeQ�ZRe#eReQe$eSeQffZTd[deQdeSde#eQeQffdd�ZUdeQdeeQeffdd �ZVdeQdeWfd!d"�ZXd#edeWfd$d%�ZYd&e4de#eeQeQfeeQeQfffd'd(�ZZd)e!eQde eQfd*d+�Z[d,eeTdee#eQeQeQffd-d.�Z\d/eRdeQfd0d1�Z]d\deQd2e eQdeRfd3d4�Z^d5eeeQd6eeReRfd7e"eRd8eeQd9eQdeeTfd:d;�Z_d<eeQeQfdeeQfd=d>�Z`Gd?d@�d@�ZaGdAdB�dB�ZbGdCdD�dDe0�ZcdEeQddfdFdG�ZdGdHdI�dIe*�Ze	J	J		Kd]dLeQdMe'dNeQdOe<dPeWdQeWdRe e9dSeWddfdTdU�ZfejgdVeQdedfdWdX��Zh	J	J		Kd]dLeQdNeQdOe<dVeQdPeWdQeWdRe e9dSeWddfdYdZ�ZidS)^zGSupport for installing and building the "wheel" binary package format.
�N)�urlsafe_b64encode)�Message)�chain�filterfalse�starmap)�IO�
TYPE_CHECKING�Any�BinaryIO�Callable�Dict�Iterable�Iterator�List�NewType�Optional�Sequence�Set�Tuple�Union�cast)�ZipFile�ZipInfo)�ScriptMaker)�get_export_entry)�canonicalize_name)�InstallationError)�get_major_minor_version)�BaseDistribution�FilesystemWheel�get_wheel_distribution)�DIRECT_URL_METADATA_NAME�	DirectUrl)�SCHEME_KEYS�Scheme)�adjacent_tmp_file�replace)�captured_stdout�
ensure_dir�	hash_file�	partition)�
current_umask�is_within_directory�2set_extracted_file_to_default_mode_plus_executable�zip_item_is_executable)�parse_wheel)�Protocolc@s0eZdZUded<eed<eed<d	dd�ZdS)
�File�
RecordPath�src_record_path�	dest_path�changed�returnNcCsdS�N���selfr8r8�H/usr/lib/python3/dist-packages/pip/_internal/operations/install/wheel.py�saveE�z	File.save�r6N)�__name__�
__module__�__qualname__�__annotations__�str�boolr<r8r8r8r;r1@s

r1r2��path�	blocksizer6cCs6t||�\}}dt|����d��d�}|t|�fS)z?Return (encoded_digest, length) for path using hashlib.sha256()zsha256=�latin1�=)r)r�digest�decode�rstriprC)rFrG�h�lengthrJr8r8r;�rehashOsrO�modecCs|ddd�S)zPReturn keyword arguments to properly open a CSV file
    in the given mode.
    ��utf-8)rP�newline�encodingr8)rPr8r8r;�
csv_io_kwargsVsrUcCs�tj�|�sJ�t|d��0}|��}|�d�s 	Wd�dStj�t�	��}d|tj
�d�}|��}Wd�n1s@wYt|d��}|�|�|�|�Wd�dS1s`wYdS)	zQReplace #!python with #!/path/to/python
    Return True if file was changed.
    �rbs#!pythonNFs#!�ascii�wbT)
�osrF�isfile�open�readline�
startswith�sys�
executable�encode�getfilesystemencoding�linesep�read�write)rF�script�	firstline�exename�restr8r8r;�
fix_script]s"
�
�

��ri�metadatacCs|�dd���dkS)NzRoot-Is-PurelibrQ�true)�get�lower)rjr8r8r;�wheel_root_is_purelibqsrn�distcCsLi}i}|��D]}|jdkr|j||j<q|jdkr!|j||j<q||fS)N�console_scripts�gui_scripts)�iter_entry_points�group�value�name)rorprq�entry_pointr8r8r;�get_entrypointsus

�rw�scriptsc
s~|sdSt�t�}|D]}tj�|�}tj�|�}||�|�qdd�tj�	dd��
tj�D����tj�
tj�tj����fdd�|��D�}|sNdSg}|��D]1\}}t|�}t|�dkrjd	�|d
�}	nd�d�|dd
��d|d
�}	|�d�|	|��qTd}
t|�dkr�|�|
�d��n|�|
�d��tdd�tj�	dd��
tj�D��}|r�d}|�|�d�|�S)z�Determine if any scripts are not on PATH and format a warning.
    Returns a warning message if one or more scripts are not on PATH,
    otherwise None.
    NcSs g|]}tj�|��tj��qSr8)rYrF�normcaserL�sep��.0�ir8r8r;�
<listcomp>�s��z5message_about_scripts_not_on_PATH.<locals>.<listcomp>�PATHrQcs&i|]\}}tj�|��vr||�qSr8)rYrFry)r|�
parent_dirrx��
not_warn_dirsr8r;�
<dictcomp>�s
�z5message_about_scripts_not_on_PATH.<locals>.<dictcomp>�zscript {} isrzscripts {} are�, ���z and z.The {} installed in '{}' which is not on PATH.zeConsider adding {} to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.zthis directoryzthese directoriescss �|]}|r|ddkVqdS)r�~Nr8r{r8r8r;�	<genexpr>�s��

�z4message_about_scripts_not_on_PATH.<locals>.<genexpr>ziNOTE: The current PATH contains path(s) starting with `~`, which may not be expanded by all applications.�
)�collections�defaultdict�setrYrF�dirname�basename�add�environrl�split�pathsep�appendryr^r_�items�sorted�len�format�join�any)
rx�grouped_by_dir�destfiler��script_name�warn_for�	msg_lines�dir_scripts�sorted_scripts�
start_text�
last_line_fmt�warn_for_tilde�tilde_warning_msgr8r�r;�!message_about_scripts_not_on_PATH�sT
�
�������

r��outrowscCstdd�|D��S)a�Normalize the given rows of a RECORD file.

    Items in each row are converted into str. Rows are then sorted to make
    the value more predictable for tests.

    Each row is a 3-tuple (path, hash, size) and corresponds to a record of
    a RECORD file (see PEP 376 and PEP 427 for details).  For the rows
    passed to this function, the size can be an integer as an int or string,
    or the empty string.
    css$�|]
\}}}||t|�fVqdSr7)rC)r|�record_path�hash_�sizer8r8r;r��s�
�z&_normalized_outrows.<locals>.<genexpr>)r�)r�r8r8r;�_normalized_outrows�s�r�r�cCs|Sr7r8)r�r8r8r;�_record_to_fs_path�r=r��relative_tocCsX|durtj�|�d��tj�|�d��krtj�||�}|�tjjd�}td|�S)Nr�/r2)rYrF�
splitdriverm�relpathr&rzr)rFr�r8r8r;�_fs_to_record_path�s�
r��old_csv_rows�	installedr5�	generated�lib_dircCs�g}|D]H}t|�dkrt�d|�td|d�}|�||�}||vr,tt|��\}	}
nt|�dkr6|dnd}	t|�dkrB|dnd}
|�||	|
f�q|D]}t||�}t|�\}	}
|�||	|
f�qO|�	�D]
}
|�|
ddf�qi|S)z_
    :param installed: A map from archive RECORD path to installation RECORD
        path.
    �z,RECORD line has more than three elements: %sr2rr�rQ�)
r��logger�warningr�poprOr�r�r��values)r�r�r5r�r��installed_rows�row�old_record_path�new_record_pathrJrN�frF�installed_record_pathr8r8r;�get_csv_rows_for_installed�s$
r��consolecCs|��}g}|�dd�}|rJdtjvr|�d|�tj�dd�dkr/|�d�tjd|��|�dt	��d	|���d
d�|D�}|D]}||=qD|�dd�}|rwdtjvr^|�d
|�|�d�t	�|��dd�|D�}|D]}||=qq|�
tdj|����|S)zk
    Given the mapping from entrypoint name to callable, return the relevant
    console script specs.
    �pipN�ENSUREPIP_OPTIONSzpip = rQ�
altinstallz
pip{} = {}rz = cS�g|]
}t�d|�r|�qS)zpip(\d(\.\d)?)?$��re�match�r|�kr8r8r;r~Jsz,get_console_script_specs.<locals>.<listcomp>�easy_installzeasy_install = zeasy_install-{} = {}cSr�)zeasy_install(-\d\.\d)?$r�r�r8r8r;r~Xs
���{} = {})
�copyr�rYr�r�rlr�r^�version_infor�extendrr�)r��scripts_to_generate�
pip_script�pip_epr��easy_install_script�easy_install_epr8r8r;�get_console_script_specss<#
�
���r�c@s>eZdZdedededdfdd�Zdefdd	�Zdd
d�Z	dS)
�
ZipBackedFiler3r4�zip_filer6NcCs||_||_||_d|_dS�NF)r3r4�	_zip_filer5)r:r3r4r�r8r8r;�__init__es
zZipBackedFile.__init__cCs|j�|j�Sr7)r��getinfor3r9r8r8r;�_getinfomszZipBackedFile._getinfoc	Cs�tj�|j�}t|�tj�|j�rt�|j�|��}|j�	|��$}t	|jd��}t
�||�Wd�n1s:wYWd�n1sIwYt|�rYt
|j�dSdS)NrX)rYrFr�r4r(�exists�unlinkr�r�r[�shutil�copyfileobjr.r-)r:r��zipinfor��destr8r8r;r<ps
����zZipBackedFile.saver>)
r?r@rAr2rCrr�rr�r<r8r8r8r;r�ds���
�r�c@s eZdZd	dd�Zd
dd�ZdS)�
ScriptFile�filer1r6NcCs$||_|jj|_|jj|_d|_dSr�)�_filer3r4r5)r:r�r8r8r;r��s


zScriptFile.__init__cCs|j��t|j�|_dSr7)r�r<rir4r5r9r8r8r;r<�s
zScriptFile.save)r�r1r6Nr>)r?r@rAr�r<r8r8r8r;r��s
r�cs&eZdZdeddf�fdd�Z�ZS)�MissingCallableSuffixrvr6Ncst��d�|��dS)Nz�Invalid script entry point: {} - A callable suffix is required. Cf https://packaging.python.org/specifications/entry-points/#use-for-scripts for more information.)�superr�r�)r:rv��	__class__r8r;r��s�zMissingCallableSuffix.__init__)r?r@rArCr��
__classcell__r8r8r�r;r��sr��
specificationcCs.t|�}|dur|jdurtt|���dSdSr7)r�suffixr�rC)r��entryr8r8r;�_raise_for_invalid_entrypoint�s�r�cs8eZdZddedeeefdeef�fdd�
Z�ZS)�PipScriptMakerNr��optionsr6cst|�t��||�Sr7)r�r��make)r:r�r�r�r8r;r��szPipScriptMaker.maker7)	r?r@rArCrr	rr�r�r8r8r�r;r��s0r�TFru�	wheel_zip�
wheel_path�scheme�	pycompile�warn_script_location�
direct_url�	requestedc8	s(t||�\}}	t|	�r|j�n|j�i�t��g}
	d8dtdtdtddf���fdd�
}d	tdtfd
d�}dtd
tddf�fdd��dtdtdt	tgdff�fdd�}
dtdt
dt	tgdff��fdd�}d	tdtfdd�}ttt|�
��}t||�}t||�\}}|
|��}t||�}d	tdtfdd�}t||�\}}|||�}t||�}t||�}tt��t|��}t|�\��dddtf��fdd�}t||�}t||�}tt|�}t||�}|D]}|��||j|j|j�q�dttf��fdd �}d	tdtfd!d"�} |�rkt��Q}!t���<t�d#�|�D]+}"t j!|"d$d$d%�}#|#�rB| |"�}$t"j#�$|$��s2J�td&|$�%t"j#j&d'��}%||%|$��qWd�n	1�sOwYWd�n	1�s_wYt'�(|!�)��t*d|j+�}&d$|&_,d(h|&_-d$|&_.t/��}'t0t1d)j2��3���}(|&�4|'�})|
�5|)�|
�5|&�4|(d*d$i��|�r�t6|)�}*|*du�r�t'�7|*�d+t8�@�t9j:d	td,t;dtt<f�fd-d.��}+t"j#�=�|�},t"j#�=|,d/�}-|+|-��
}.|.�>d0�Wd�n	1�s�wY|
�?|-�|du�r$t"j#�=|,t@�}/|+|/��}0|0�>|�A��Bd1��Wd�n	1�swY|
�?|/�|�rIt"j#�=|,d2�}1tC|1d3��Wd�n	1�s?wY|
�?|1�|�Dd4�}2t0tE�F|2�G���}3tH|3��|
�d5�}4t"j#�=|,d4�}5|+|5fitId6����}6tE�Jtd7|6��}7|7�KtL|4��Wd�dS1�s�wYdS)9a�Install a wheel.

    :param name: Name of the project to install
    :param wheel_zip: open ZipFile for wheel being installed
    :param scheme: Distutils scheme dictating the install directories
    :param req_description: String used in place of the requirement, for
        logging
    :param pycompile: Whether to byte-compile installed Python files
    :param warn_script_location: Whether to check that scripts are installed
        into a directory on PATH
    :raises UnsupportedWheel:
        * when the directory holds an unpacked wheel with incompatible
          Wheel-Version
        * when the .dist-info dir does not match the wheel
    F�srcfiler��modifiedr6Ncs,t|��}|�|<|r��t|��dSdS)z6Map archive RECORD paths to installation RECORD paths.N)r�r�)r�r�r��newpath)r5r�r�r8r;�record_installed�s

�z(_install_wheel.<locals>.record_installedrFcSs
|�d�S)Nr�)�endswith�rFr8r8r;�is_dir_path�s
z#_install_wheel.<locals>.is_dir_path�
dest_dir_path�target_pathcs$t||�sd}t|��||���dS)NzRThe wheel {!r} has a file {!r} trying to install outside the target directory {!r})r,rr�)rr�message)r�r8r;�assert_no_path_traversal�s
���z0_install_wheel.<locals>.assert_no_path_traversalr�r�r1csdtddf���fdd�}|S)Nr�r6r1cs0tj�|�}tj��|�}��|�t||��Sr7)rYrF�normpathr�r�)r��normed_pathr4)rr�r�r8r;�make_root_scheme_file�s
zM_install_wheel.<locals>.root_scheme_file_maker.<locals>.make_root_scheme_file)r2)r�r�r)r)r�r�r;�root_scheme_file_maker�sz._install_wheel.<locals>.root_scheme_file_makerr�cs2�fdd�tD��dtddf����fdd�}|S)Ncsi|]}|t�|��qSr8)�getattr)r|�key)r�r8r;r��szB_install_wheel.<locals>.data_scheme_file_maker.<locals>.<dictcomp>r�r6r1c		s�tj�|�}z
|�tjjd�\}}}Wnty$d��|�}t|��wz�|}WntyEd�	t
���}d��|||�}t|��wtj�	||�}�||�t||��S)Nr�zbUnexpected file in {}: {!r}. .data directory contents should be named like: '<scheme key>/<path>'.r�z�Unknown scheme key used in {}: {} (for file {!r}). .data directory contents should be in subdirectories named with a valid scheme key ({}))rYrFrr�rz�
ValueErrorr�r�KeyErrorr�r�r�)	r�r�_�
scheme_key�dest_subpathr�scheme_path�valid_scheme_keysr4)r�scheme_pathsr�r�r8r;�make_data_scheme_file�s*����	
zM_install_wheel.<locals>.data_scheme_file_maker.<locals>.make_data_scheme_file)r#r2)r�r�r)rr�)r�rr�r;�data_scheme_file_maker�sz._install_wheel.<locals>.data_scheme_file_makercSs|�dd�d�d�S)Nr�r�r�.data)r�r�r�r8r8r;�is_data_scheme_pathsz+_install_wheel.<locals>.is_data_scheme_pathcSs2|�dd�}t|�dko|d�d�o|ddkS)Nr�r�rrr�rx)r�r�r�)rF�partsr8r8r;�is_script_scheme_path"s&z-_install_wheel.<locals>.is_script_scheme_pathr�csz|j}tj�|�}|���d�r|dd�}n|���d�r%|dd�}n|���d�r3|dd�}n|}|�vp<|�vS)Nz.exe���z
-script.pyi����z.pya)r4rYrFr�rmr�)r�rFru�	matchname)r��guir8r;�is_entrypoint_wrapper5sz-_install_wheel.<locals>.is_entrypoint_wrapperc3sJ�tt�����D]}tj��|�}tj�|�sq	|�d�sq	|Vq	dS)Nz.py)r�r�r�rYrFr�rZr�)�installed_path�full_installed_path)r�r�r8r;�pyc_source_file_pathsPs�
�z-_install_wheel.<locals>.pyc_source_file_pathscSstj�|�S)z8Return the path the pyc file would have been written to.)�	importlib�util�cache_from_sourcer�r8r8r;�pyc_output_path]sz'_install_wheel.<locals>.pyc_output_path�ignoreT)�force�quietr2r�rQr�ri��kwargsc;sV�t|fi|���}|VWd�n1swYt�|j��t|j|�dSr7)r%rY�chmodrur&)rFr'r�)�generated_file_moder8r;�_generate_file�s��z&_install_wheel.<locals>._generate_file�	INSTALLERspip
rR�	REQUESTEDrX�RECORD)r�r5r�r��wzIO[str])F)Mr/rn�purelib�platlibr�r2rCrDrrr$rr�namelistrr*�maprr rrrwr�r<r3r4r5rr'�warnings�catch_warnings�filterwarnings�
compileall�compile_filerYrFr�r&rzr��debug�getvaluer�rx�clobber�variants�set_moder��listrr�r��
make_multipler�r�r�r+�
contextlib�contextmanagerr	r
r�rdr�r!�to_jsonr`r[�	read_text�csv�reader�
splitlinesr�rU�writer�	writerowsr�)8rur�r�r�r�r�r�r��info_dirrjr�r�rrrr�paths�
file_paths�root_scheme_paths�data_scheme_pathsr�filesr�other_scheme_paths�script_scheme_pathsr�other_scheme_files�distributionr�script_scheme_filesr�rr#�stdoutrF�success�pyc_path�pyc_record_path�makerr��gui_scripts_to_generate�generated_console_scripts�msgr*�
dest_info_dir�installer_path�installer_file�direct_url_path�direct_url_file�requested_path�record_text�record_rows�rowsr��record_filerFr8)rr5r�r)rr�r�r�r;�_install_wheel�s�����	
������!


�


��






�
�����



 
�


�
�

�	$�re�req_descriptionc
csD�zdVWdSty!}zd�||jd�}t|�|�d}~ww)NzFor req: {}. {}r)rr��args)rf�err8r8r;�req_error_context�s�
��ric	Cs�t|dd��1}t|��t||||||||d�Wd�n1s"wYWd�dSWd�dS1s:wYdS)NT)�
allowZip64)rur�r�r�r�r�r�r�)rrire)	rur�r�rfr�r�r�r��zr8r8r;�
install_wheel�s 

���"�rl)rEr7)TTNF)j�__doc__r�r6r?rCr �logging�os.pathrYr�r�r^r3�base64r�
email.messager�	itertoolsrrr�typingrrr	r
rrr
rrrrrrrrr�zipfilerr�pip._vendor.distlib.scriptsr�pip._vendor.distlib.utilr�pip._vendor.packaging.utilsr�pip._internal.exceptionsr�pip._internal.locationsr�pip._internal.metadatarrr �pip._internal.models.direct_urlr!r"�pip._internal.models.schemer#r$�pip._internal.utils.filesystemr%r&�pip._internal.utils.miscr'r(r)r*�pip._internal.utils.unpackingr+r,r-r.�pip._internal.utils.wheelr/r0r1�	getLoggerr?r�rCr2�int�InstalledCSVRowrOrUrDrirnrwr�r�r�r�r�r�r�r�r�r�r�rer@rirlr8r8r8r;�<module>s�H
	
 *H�
�
�
����
� Q(
���������	
�
���������	�