HEX
Server: nginx/1.24.0
System: Linux webserver 6.8.0-85-generic #85-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep 18 15:26:59 UTC 2025 x86_64
User: wpuser (1002)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/pip/_internal/operations/__pycache__/prepare.cpython-312.pyc
�

��h�m���dZddlZddlZddlZddlmZddlmZmZm	Z	m
Z
ddlmZddl
mZddlmZddlmZmZmZmZmZmZmZdd	lmZdd
lmZmZddlmZddl m!Z!dd
l"m#Z#ddl$m%Z%m&Z&ddl'm(Z(m)Z)ddl*m+Z+ddl,m-Z-ddl.m/Z/ddl0m1Z1ddl2m3Z3m4Z4ddl5m6Z6m7Z7ddl8m9Z9ddl:m;Z;m<Z<m=Z=m>Z>ddl?m@Z@ddlAmBZBddlCmDZDe1eE�ZFde/de-dedeGdeGd efd!�ZHd"e!d#eId$eJd dfd%�ZKGd&�d'�ZL		d2d"e!d(e&d)e
eId*e
e6d eLf
d+�ZM	d2d"e!d)e
eId*e
e6d eLfd,�ZN		d2d"e!d#eId(e&d$eJd)e
eId*e
e6d e
eLfd-�ZO	d3d"e!d)eId*e
e6d.eGd e
eIf
d/�ZPGd0�d1�ZQy)4z)Prepares a distribution for installation
�N)�Path)�Dict�Iterable�List�Optional)�canonicalize_name)�)make_distribution_for_install_requirement)�InstalledDistribution)�DirectoryUrlHashUnsupported�HashMismatch�HashUnpinned�InstallationError�MetadataInconsistent�NetworkConnectionError�VcsHashUnsupported)�
PackageFinder)�BaseDistribution�get_metadata_distribution)�ArchiveInfo)�Link)�Wheel)�BatchDownloader�
Downloader)�HTTPRangeRequestUnsupported�dist_from_wheel_url)�
PipSession)�BuildTracker)�InstallRequirement)�	getLogger)�direct_url_for_editable�direct_url_from_link)�Hashes�
MissingHashes)�
indent_log)�display_path�	hash_file�hide_url�redact_auth_from_requirement)�
TempDirectory)�unpack_file)�vcs�req�
build_tracker�finder�build_isolation�check_build_deps�returnc��t|�}|j}|�>|j||�5|j|||�ddd�|j	�S|j	�S#1swY|j	�SxYw)z(Prepare a distribution for installation.N)r	�build_tracker_id�track�prepare_distribution_metadatar)r,r-r.r/r0�
abstract_dist�
tracker_ids       �B/usr/lib/python3/dist-packages/pip/_internal/operations/prepare.py�_get_prepared_distributionr9;s���>�c�B�M��/�/�J���
�
 �
 ��j�
1�	��7�7���)9�
�	��2�2�4�4�=�2�2�4�4�		��2�2�4�4�s�A(�(B�link�location�	verbosityc��tj|j�}|�J�|j|t	|j
�|��y)N)�urlr<)r+�get_backend_for_scheme�scheme�unpackr'r>)r:r;r<�vcs_backends    r8�unpack_vcs_linkrCMs@���,�,�T�[�[�9�K��"�"�"����x�X�d�h�h�%7�9��M�c�&�eZdZdedeeddfd�Zy)�File�path�content_typer1Nc�`�||_|�tj|�d|_y||_y)Nr)rG�	mimetypes�
guess_typerH)�selfrGrHs   r8�__init__z
File.__init__Ts/����	��� )� 4� 4�T� :�1� =�D�� ,�D�rD)�__name__�
__module__�__qualname__�strrrM�rDr8rFrFSs ��-�S�-���
�-�$�-rDrF�download�download_dir�hashesc��tdd��}d}|r
t|||�}|r|}d}n)|||j�\}}|r|j|�t	||�S)NrAT��kind�globally_managed)r)�_check_download_dirrG�check_against_pathrF)r:rSrTrU�temp_dir�already_downloaded_path�	from_pathrHs        r8�get_http_urlr_\sj���(�T�B�H�"���"5�d�L�&�"Q���+�	���#+�4����"?��	�<���%�%�i�0��	�<�(�(rDc��d}|r
t|||�}|r|}n|j}|r|j|�t|d�S)z'Get file and optionally check its hash.N)rZ�	file_pathr[rF)r:rTrUr]r^s     r8�get_file_urlrbtsM��
#���"5�d�L�&�"Q���+�	��N�N�	���!�!�)�,��	�4� � rDc��|jrt|||��y|j�rJ�|jrt	|||��}nt||||��}|js!t|j||j�|S)a_Unpack link into location, downloading if required.

    :param hashes: A Hashes object, one of whose embedded hashes must match,
        or HashMismatch will be raised. If the Hashes is empty, no matches are
        required, and unhashable types of requirements (like VCS ones, which
        would ordinarily raise HashUnsupported) are allowed.
    )r<N�rU)
�is_vcsrC�is_existing_dir�is_filerbr_�is_wheelr*rGrH)r:r;rSr<rTrU�files       r8�
unpack_urlrj�s�� �{�{���h�)�<���#�#�%�%�%��|�|��D�,�v�>�������	
���=�=��D�I�I�x��):�):�;��KrD�warn_on_hash_mismatchc�j�tjj||j�}tjj	|�syt
j
d|�|r	|j|�|S|S#t$r0|rt
jd|�tj|�YywxYw)z�Check download_dir for previously downloaded file with correct hash
    If a correct file is found return its path else None
    NzFile was already downloaded %sz;Previously-downloaded file %s has bad hash. Re-downloading.)�osrG�join�filename�exists�logger�infor[r�warning�unlink)r:rTrUrk�
download_paths     r8rZrZ�s����G�G�L�L��t�}�}�=�M�
�7�7�>�>�-�(���K�K�0�-�@�
�		��%�%�m�4���=����	�$����Q�!��
�I�I�m�$��	�s�$A9�96B2�1B2c�x��eZdZdZdedeedededededed	ed
e	deded
ede
deddf�fd�Zdeddfd�Z
dededdfd�Zdedefd�Zdedeefd�Zdedeefd�Zdedeefd�Z	d&deededdfd�Z	d&dededefd�Z	d&deededdfd �Zdededefd!�Zdeddfd"�Zdedefd#�Zded$edefd%�Z�xZS)'�RequirementPreparerzPrepares a Requirement�	build_dirrT�src_dirr/r0r-�session�progress_barr.�require_hashes�
use_user_site�
lazy_wheelr<�legacy_resolverr1Nc�8��t�|��||_||_||_||_t
||�|_t||�|_	|	|_
||_||_||_
|
|_||_||_|
|_||_i|_d|_y)N)�r�)�superrMryrxr-�_sessionr�	_downloadr�_batch_downloadr.rTr/r0r|r}�use_lazy_wheelr<r�_downloaded�_previous_requirement_header)rLrxrTryr/r0r-rzr{r.r|r}r~r<r�	__class__s               �r8rMzRequirementPreparer.__init__�s����"	�������"���*�����
�#�G�\�:���.�w��E������)��� /���!1���-���+���)���#��� /���,.���-5��)rDr,c���|jjr7|js+d}tt	|jj
��}n.d}|jrt|j�n
t|�}|jrX|jrLt|jt�r
|j}n|jj�}|r	|d|�d�z
}||f|jk7r||f|_tj||�|jr>t�5tjd|jj�ddd�yy#1swYyxYw)z3Provide context for the requirement being prepared.z
Processing %sz
Collecting %sz (from �)zUsing cached %sN)r:rg�is_wheel_from_cacherQr%rar,r(�
comes_from�
isinstancer^r�rqrrr$ro)rLr,�message�informationr�s     r8�_log_preparing_linkz'RequirementPreparer._log_preparing_links���8�8���C�$;�$;�%�G��l�3�8�8�+=�+=�>�?�K�%�G�CF�7�7�6�s�w�w�?�PS�TW�PX�K��7�7�s�~�~��#�.�.�#�.�,/�N�N�
� �^�^�5�5�7�
������A�6�6���[�!�T�%F�%F�F�18�+�0F�D�-��K�K���-��"�"���
B����-�s�x�x�/@�/@�A�
B�
B�#�
B�
B�s�&+E�E$�parallel_buildsc��|jjry|j�J�|jj�r|jj|_y|j|jd|��|j�y)z1Ensure source_dir of a linked InstallRequirement.NT)�
autodeleter�)r:rh�
source_dirrfra�ensure_has_source_dirrx�ensure_pristine_source_checkout)rLr,r�s   r8�_ensure_link_req_src_dirz,RequirementPreparer._ensure_link_req_src_dir-sz��
�8�8���
��~�~�%�%�%��8�8�#�#�%� �X�X�/�/�C�N��	�!�!��N�N��+�	"�	
�
	�+�+�-rDc�F�|js|jd��S|jjr
t	��|jj�r
t
��|js|js
t��|jd��xs
t�S)NT)�trust_internetF)r|rUr:rerrfr�	is_direct�	is_pinnedr
r#�rLr,s  r8�_get_linked_req_hashesz*RequirementPreparer._get_linked_req_hashesDs~���"�"��:�:�T�:�2�2��8�8�?�?�$�&�&��8�8�#�#�%�-�/�/��}�}�S�]�]��.� ��z�z��z�/�B�=�?�BrDc���|jrtjd�y|jrtjd�y|j	|�xs|j|j�S)Nz9Metadata-only fetching is not used in the legacy resolverz?Metadata-only fetching is not used as hash checking is required)rrq�debugr|�$_fetch_metadata_using_link_data_attr� _fetch_metadata_using_lazy_wheelr:r�s  r8�_fetch_metadata_onlyz(RequirementPreparer._fetch_metadata_onlydsk������L�L�K�
������L�L�Q�
���8�8��
�=�
�
2�
2�3�8�8�
<�	=rDc��|jj�}|�y|j�J�tj	d|j|�t||j|j���}t|jd�5}|j�}ddd�t|jj|jj�}t|j�t|jj�k7r,t!|d|jj|j��|S#1swY��xYw)zGFetch metadata from the data-dist-info-metadata attribute, if possible.Nz/Obtaining dependency information for %s from %srd�rb�Name)r:�
metadata_linkr,rq�verboser_r��	as_hashes�openrG�readrro�namer�raw_namer)rLr,r��
metadata_file�f�metadata_contents�
metadata_dists       r8r�z8RequirementPreparer._fetch_metadata_using_link_data_attrws�����.�.�0�
�� ���w�w�"�"�"����=��G�G��	
�%���N�N� �*�*�,�
�
�
�-�$�$�d�
+�	)�q� !�����	)�2���H�H����G�G�L�L�
�
��]�3�3�4�8I�#�'�'�,�,�8W�W�&��V�S�W�W�\�\�=�+A�+A��
���%	)�	)�s�	D:�:Er:c���|jsy|js|jstj	d|�yt|j�}t|j�}tjd||j�|jjdd�d}	t|||j�S#t$rtj	d|�YywxYw)z-Fetch metadata using lazy wheel, if possible.Nz=Lazy wheel is not used as %r does not point to a remote wheelz+Obtaining dependency information from %s %s�#�rz"%s does not support range requests)r�rgrhrqr�rrorr�rr�versionr>�splitrr�r)rLr:�wheelr�r>s     r8r�z4RequirementPreparer._fetch_metadata_using_lazy_wheel�s����"�"���<�<�t�}�}��L�L�O��
���d�m�m�$�� ����,�����9���M�M�	
�
�h�h�n�n�S�!�$�Q�'��	�&�t�S�$�-�-�@�@��*�	��L�L�=�s�C��	�s�(B?�?C!� C!�partially_downloaded_reqsc���tdd��j}i}|D]}|jsJ�|||j<�!|j|j	�|�}|D]u\}\}}	t
j
d||�||}||_||j|jj<|jr�\|jt|���w|D]}|j||��y)z>Download any requirements which were only fetched by metadata.rATrWzDownloading link %s to %sN)r)rGr:r��keysrqr��local_file_pathr�r>rh�needs_unpacked_archiver�_prepare_linked_requirement)
rLr�r�r\�links_to_fully_downloadr,�batch_downloadr:�filepath�_s
          r8�_complete_partial_requirementsz2RequirementPreparer._complete_partial_requirements�s��!�h��F�K�K��
CE��,�	4�C��8�8�O�8�03�#�C�H�H�-�	4��-�-�#�(�(�*��
��$2�	;��D�-�8�Q��L�L�4�d�H�E�)�$�/�C�#+�C��.6�D���S�X�X�\�\�*��<�<��*�*�4��>�:�	;�&-�	C�C��,�,�S�/�B�	CrDc��|jsJ�|j|�t�5d}|j�U|jjr?|j|�}t
|j|j||j��}|�$||j|jj<n%|j|�}|�d|_|cddd�S|j||�cddd�S#1swYyxYw)z3Prepare a requirement to be obtained from req.link.N)rkT)
r:r�r$rTrhr�rZr�r�r>r��needs_more_preparationr�)rLr,r�rarUr�s      r8�prepare_linked_requirementz.RequirementPreparer.prepare_linked_requirement�s����x�x��x�� � ��%�
�\�	J��I�� � �,����1B�1B��4�4�S�9��/��H�H��%�%��/2�.E�.E�*E��	��$�1:�� � ������.�!%� 9� 9�#� >�
� �,�15�C�.�(�7	J�	J�<�3�3�C��I�=	J�	J�	J�s�B%C4�C4�4C=�reqsc���|D�cgc]}|js�|��}}|D]�}|j��|jjs�'|j	|�}t|j|j|�}|��\||j|jj<d|_��g}|D]2}|jr|j|��!|j||��4|j||��ycc}w)z,Prepare linked requirements more, if needed.NF)r�)r�rTr:rhr�rZr�r>�appendr�r�)rLr�r�r,rUrar�s       r8� prepare_linked_requirements_morez4RequirementPreparer.prepare_linked_requirements_mores��� $�B��s�'A�'A��B��B��	7�C�� � �,����1B�1B��4�4�S�9��/����$�:K�:K�V�T�	��(�5>�D�$�$�S�X�X�\�\�2�16�C�.�	7�?A�!��	G�C��)�)�)�0�0��5��0�0��o�F�		G�	
�+�+�%�+�	,�	
��+Cs
�C4�C4c	���|jsJ�|j}|j|�}|r�|jr�|j�J�|jsJ�|j
sJ�t
|jjt�rR|jjjr2|j|jjj�rd}n2tjd�|j|_|j}|j||�|j�rd}n�|j |j"vr:	t%||j&|j(|j*|j,|�}n9|j"|j }|r|j3|�t5|d��}|j��|j6rJ�t9||j&�|_t
|jjt�rf|jjjsF|rDt;|j<�dj?�}d|��|jj_ |r|j<|_!tE||jF|jH|jJ|jL�}	|	S#t.$r}t1d|�d|�d|����d}~wwxYw)NzyThe hashes of the source archive found in cache entry don't match, ignoring cached built wheel and re-downloading source.zCould not install requirement z because of HTTP error z	 for URL )rHrzsha256=)'r:r�r��
download_inforhrgr�rrrrU�
has_one_ofrqrs�cached_wheel_source_linkr�rfr>r�rjr�r�r<rTrrr[rF�editabler!r&rG�	hexdigest�hashr�r9r-r.r/r0)
rLr,r�r:rU�
local_file�excrar��dists
          r8r�z/RequirementPreparer._prepare_linked_requirement-s����x�x��x��x�x���,�,�S�1���c�-�-��$�$�0�0�0��=�=� �=��<�<��<��3�,�,�1�1�;�?��%�%�*�*�1�1��%�%�c�&7�&7�&<�&<�&C�&C�D������1��
�7�7����x�x���%�%�c�?�;����!��J�
�X�X�T�-�-�
-�

�'���N�N��N�N��N�N��%�%��
�
��(�(����2�I���)�)�)�4��i�d�;�J����$��|�|�#�#� 4�T�3�>�>� J�C���3�,�,�1�1�;�?��)�)�.�.�5�5�� ����1�!�4�>�>�@��18��v�.>��!�!�&�&�+��",�/�/�C��)������K�K�� � ��!�!�
�����W*�
�'�4�S�E�:� �E��4�&�2����
�s�
8K�	K)�K$�$K)c�n�|j�J�|j�J�|j}|js|j�r(|jr|j|j�y|j�rtjd|�y|j�ytjj|j|j�}tjj|�sBtj|j|�t!|�}tj#d|�yy)NzENot copying link to destination directory since it is a directory: %szSaved %s)rTr:rerfr��archiverqr�r�rmrGrnrorp�shutil�copyr%rr)rLr,r:�download_locationrus     r8�save_linked_requirementz+RequirementPreparer.save_linked_requirement�s���� � �,�,�,��x�x�#�#�#��x�x���;�;�4�/�/�1�c�l�l��K�K��)�)�*�����!��L�L�.��
�

����&���G�G�L�L��):�):�D�M�M�J���w�w�~�~�/�0��K�K��+�+�->�?�(�):�;�M��K�K�
�M�2�1rDc��|jsJd��tjd|�t�5|jrtd|�d���|j
|j�|j�|jsJ�t|j�|_t||j|j|j |j"�}|j%|j&�ddd�|S#1swYSxYw)z Prepare an editable requirement.z-cannot prepare a non-editable req as editablezObtaining %szThe editable requirement zT cannot be installed when requiring hashes, because there is no single file to hash.N)r�rqrrr$r|rr�ry�update_editabler�r �unpacked_source_directoryr�r9r-r.r/r0�check_if_existsr})rLr,r�s   r8�prepare_editable_requirementz0RequirementPreparer.prepare_editable_requirement�s���
�|�|�L�L�L�|����N�C�(�
�\�	4��"�"�'�/��u�5����

�%�%�d�l�l�3����!��>�>�!�>� 7��8U�8U� V�C��-���"�"�����$�$��%�%��D�
���� 2� 2�3�)	4�,��-	4�,��s�CC?�?D	�skip_reasonc�`�|jsJd��|�Jd|j����tjd|||jj�t	�5|j
rtj
d�t|�j�cddd�S#1swYyxYw)z)Prepare an already-installed requirement.z(req should have been satisfied but isn'tNz?did not get skip reason skipped but req.satisfied_by is set to zRequirement %s: %s (%s)z�Since it is already installed, we are trusting this package without checking its hash. To ensure a completely repeatable environment, install into an empty virtualenv.)	�satisfied_byrqrrr�r$r|r�r
r)rLr,r�s   r8�prepare_installed_requirementz1RequirementPreparer.prepare_installed_requirement�s������K�!K�K���&�	
�
��)�)�*�
,�	
�&�	���%�{�C��9I�9I�9Q�9Q�	
��\�	J��"�"����(��)��-�G�G�I�	J�	J�	J�s� :B$�$B-)F)rNrOrP�__doc__rQr�boolrrr�intrMrr�r�r"r�rr�r�rr�rr�r�r�r�r�r�r��
__classcell__)r�s@r8rwrw�s@��� �85��85��s�m�85��	85�
�85��
85�$�85��85��85��85��85��85��85��85��85� 
�!85�tB�'9�B�d�B�6.�%�.�8<�.�	
�.�.C�*<�C��C�@=�
�=�
�"�	#�=�&'�
�'�
�"�	#�'�R���
�"�	#��@!&�*C�#+�,>�#?�*C��*C�
�	*C�Z@E�$J�%�$J�8<�$J�	�$J�NKP�
��/�0�
�CG�
�	
�
�<Z�%�Z�8<�Z�	�Z�x3�+=�3�$�3�4�
��
��BJ�
�J��J�
�	JrDrw)NN)T)Rr�rJrmr��pathlibr�typingrrrr�pip._vendor.packaging.utilsr�pip._internal.distributionsr	�%pip._internal.distributions.installedr
�pip._internal.exceptionsrrr
rrrr�"pip._internal.index.package_finderr�pip._internal.metadatarr�pip._internal.models.direct_urlr�pip._internal.models.linkr�pip._internal.models.wheelr�pip._internal.network.downloadrr� pip._internal.network.lazy_wheelrr�pip._internal.network.sessionr�,pip._internal.operations.build.build_trackerr�pip._internal.req.req_installr�pip._internal.utils._logr�&pip._internal.utils.direct_url_helpersr r!�pip._internal.utils.hashesr"r#�pip._internal.utils.loggingr$�pip._internal.utils.miscr%r&r'r(�pip._internal.utils.temp_dirr)�pip._internal.utils.unpackingr*�pip._internal.vcsr+rNrqr�r9rQr�rCrFr_rbrjrZrwrRrDr8�<module>r�s����	�
��1�1�9�Q�G����=�N�7�*�,�F��5�E�<�.��=�2���7�5�!�	�8�	��5�	�5��5�
�5��	5�
�5��
5�$N�$�N�#�N�#�N�$�N�-�-�#'�#�	)�
�)��)��3�-�)�
�V��	)�

�)�2PT�!�
�!�&�s�m�!�<D�V�<L�!�	�!�:#'�#�
(�
�(��(��(��	(�
�3�-�(�
�V��
(��d�^�(�^#'�	�
����
�V��� �	�
�c�]��<EJ�EJrD