� ��^i]����dZddlZddlZddlZddlZddlmZmZmZm Z ddl m Z ddl m Z ddlmZddlmZmZmZmZmZmZmZddlmZdd lmZdd lmZdd lmZdd l m!Z!m"Z"dd l#m$Z$m%Z%ddl&m'Z'ddl(m)Z)ddl*m+Z+ddl,m-Z-ddl.m/Z/m0Z0ddl1m2Z2ddl3m4Z4m5Z5m6Z6m7Z7ddl8m9Z9ddl:m;Z;ddle?��Z@de)de+dedeAdef d�ZBdedeCddfd �ZDGd!�d"��ZE d2ded#e"d$e eCd%e e/deEf d&�ZFd'eCd(eCddfd)�ZGd*eCd+eCddfd,�ZH d2ded$e eCd%e e/deEfd-�ZI d2dedeCd#e"d$e eCd%e e/de eEf d.�ZJded$eCd%e e/de eCfd/�ZKGd0�d1��ZLdS)3z)Prepares a distribution for installation �N)�Dict�Iterable�List�Optional)�canonicalize_name)�)make_distribution_for_install_requirement)�InstalledDistribution)�DirectoryUrlHashUnsupported� HashMismatch� HashUnpinned�InstallationError�NetworkConnectionError�PreviousBuildDirError�VcsHashUnsupported)� PackageFinder)�BaseDistribution)�Link)�Wheel)�BatchDownloader� Downloader)�HTTPRangeRequestUnsupported�dist_from_wheel_url)� PipSession)�InstallRequirement)�RequirementTracker)� copy2_fixed)�Hashes� MissingHashes)� indent_log)� display_path�hide_url�is_installable_dir�rmtree)� TempDirectory)� unpack_file)�vcs�req� req_tracker�finder�build_isolation�returnc���t|��}|�|��5|�||��ddd��n #1swxYwY|���S)z(Prepare a distribution for installation.N)r�track�prepare_distribution_metadata�get_metadata_distribution)r'r(r)r*� abstract_dists ��/builddir/build/BUILDROOT/alt-python311-pip-21.3.1-4.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_internal/operations/prepare.py�_get_prepared_distributionr21s���>�c�B�B�M� � � �3� � �M�M��3�3�F�O�L�L�L�M�M�M�M�M�M�M�M�M�M�M����M�M�M�M� � 2� 2� 4� 4�4s�A�A �A �link�locationc��tj|j��}|�J�|�|t |j�����dS)N)�url)r&�get_backend_for_scheme�scheme�unpackr!r6)r3r4� vcs_backends r1�unpack_vcs_linkr;>sI���,�T�[�9�9�K� � "� "� "����x�X�d�h�%7�%7��8�8�8�8�8�c�.�eZdZdedeeddfd�ZdS)�File�path� content_typer+Nc�h�||_|�!tj|��d|_dS||_dS)Nr)r?� mimetypes� guess_typer@)�selfr?r@s r1�__init__z File.__init__Es;���� � � � )� 4�T� :� :�1� =�D� � � � ,�D� � � r<)�__name__� __module__� __qualname__�strrrE�r<r1r>r>DsA������-�S�-��� �-�$�-�-�-�-�-�-r<r>�download� download_dir�hashesc���tdd���}d}|rt|||��}|r|}d}n+|||j��\}}|r|�|��t ||��S)Nr9T��kind�globally_managed)r$�_check_download_dirr?�check_against_pathr>)r3rKrLrM�temp_dir�already_downloaded_path� from_pathr@s r1� get_http_urlrWMs��� �(�T�B�B�B�H�"���R�"5�d�L�&�"Q�"Q���1�+� �� � �#+�(�4���"?�"?�� �<� � 1� � %� %�i� 0� 0� 0� � �<� (� (�(r<�src�destc�� t||��dS#tj$r5}t�dt |��||��Yd}~dSd}~wwxYw)z�Copying special files is not supported, but as a convenience to users we skip errors copying them. This supports tools that may create e.g. socket files in the project source directory. z>Ignoring special file error '%s' encountered copying %s to %s.N)r�shutil�SpecialFileError�logger�warningrI)rXrY�es r1�_copy2_ignoring_special_filesr`es���  ��C�������� � "�  �  �  � ��� L� ��F�F� � �  � � � � � � � � �����  ���s��A�*A�A�source�targetc�h����tj�|��}tj�|���tj�|���dt dt t dt t f���fd� }tj�||dt���dS)N�d�namesr+c�x��g}|�kr|ddgz }tj�|���kr|�gz }|S)Nz.toxz.nox)�osr?�abspath)rdre�skippedra�target_basename�target_dirnames ���r1�ignorez!_copy_source_tree..ignore~sO����� ��;�;� ���'� '�G� �7�?�?�1� � �� /� /� ��(� (�G��r<T)rl�symlinks� copy_function) rgr?rh�basename�dirnamerIrr[�copytreer`)rarb�target_abspathrlrjrks` @@r1�_copy_source_treersys�������W�_�_�V�,�,�N��g�&�&�~�6�6�O��W�_�_�^�4�4�N� �#� �d�3�i� �D��I� � � � � � � � � �O�����3� �����r<c��d}|rt|||��}|r|}n|j}|r|�|��t|d��S)z'Get file and optionally check its hash.N)rR� file_pathrSr>)r3rLrMrUrVs r1� get_file_urlrv�si�� #���R�"5�d�L�&�"Q�"Q���#�+� � ��N� ��-��!�!�)�,�,�,� � �4� � � r<c��|jrt||��dS|���rEtj�|��rt |��t|j|��dS|j rt|||���}nt||||���}|j st|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. N)rM)�is_vcsr;�is_existing_dirrgr?�isdirr#rsru�is_filervrW�is_wheelr%r@)r3r4rKrLrM�files r1� unpack_urlr~�s��� �{����h�'�'�'��t� ������ �7�=�=�� "� "� � �8� � � ��$�.�(�3�3�3��t� �|�  ��D�,�v�>�>�>���� � � ��  � � �� �=�<��D�I�x��):�;�;�;� �Kr<c�z�tj�||j��}tj�|��sdSt �d|��|rW |�|��n@#t$r3t � d|��tj |��YdSwxYw|S)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.) rgr?�join�filename�existsr]�inforSr r^�unlink)r3rLrM� download_paths r1rRrR�s��� �G�L�L��t�}�=�=�M� �7�>�>�-� (� (���t� �K�K�0�-�@�@�@� � � � � %� %�m� 4� 4� 4� 4��� � � � �N�N�M�� � � � �I�m� $� $� $��4�4�  ���� �s�%A;�;9B8�7B8c�\��eZdZdZdedeedededededed e d ed ed ed eddf�fd� Z de ddfd�Z de deddfd�Z de defd�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_dirrL�src_dirr*r(�session� progress_barr)�require_hashes� use_user_site� lazy_wheel� in_tree_buildr+Nc �R��t�����||_||_||_||_t ||��|_t||��|_ ||_ ||_ ||_ | |_ | |_| |_| |_i|_d|_dS)N)�r�)�superrEr�r�r(�_sessionr� _downloadr�_batch_downloadr)rLr*r�r��use_lazy_wheelr�� _downloaded�_previous_requirement_header)rDr�rLr�r*r(r�r�r)r�r�r�r�� __class__s �r1rEzRequirementPreparer.__init__s���� ���������� �"���&����� �#�G�\�:�:���.�w� �E�E����� �)��� /���-���+���)���+���,.���-5��)�)�)r<r'c��|jjr0|js)d}tt |jj����}nd}t|jp|��}||f|jkr$||f|_t� ||��|jrNt��5t� d|jj ��ddd��dS#1swxYwYdSdS)z3Provide context for the requirement being prepared.z Processing %sz Collecting %szUsing cached %sN) r3r{�original_link_is_in_wheel_cacherIr rur'r�r]r�rr�)rDr'�message� informations r1�_log_preparing_linkz'RequirementPreparer._log_preparing_link3s:�� �8� � .�C�$G� .�%�G��l�3�8�+=�>�>�?�?�K�K�%�G��c�g�n��-�-�K� �[� !�T�%F� F� F�18�+�0F�D� -� �K�K��� -� -� -� � .� B���� B� B�� � �-�s�x�/@�A�A�A� B� B� B� B� B� B� B� B� B� B� B� B���� B� B� B� B� B� B� B� Bs�&C�C�C�parallel_buildsc�L�|jjrdS|j�J�|j���r|jr|jj|_dS|�|jd|���t|j��r(td� ||j�����dS)z1Ensure source_dir of a linked InstallRequirement.NT)� autodeleter�z�pip can't proceed with requirements '{}' due to apre-existing build directory ({}). This is likely due to a previous installation that failed . pip is being responsible and not assuming it can delete this. Please delete it and try again.) r3r|� source_dirryr�ru�ensure_has_source_dirr�r"r�format)rDr'r�s r1�_ensure_link_req_src_dirz,RequirementPreparer._ensure_link_req_src_dirDs��� �8� � � �F��~�%�%�%� �8� #� #� %� %� �$�*<� � �X�/�C�N� �F� �!�!� �N��+� "� � � � �c�n� -� -� �'�2�39�&��c�n�2M�2M� �� � � r<c�>�|js|�d���S|jjrt ���|j���rt ���|j�|jst���|�d���p t��S)NT)�trust_internetF) r�rMr3rxrryr � original_link� is_pinnedr r)rDr's r1�_get_linked_req_hashesz*RequirementPreparer._get_linked_req_hashesis��� �"� 3��:�:�T�:�2�2� 2� �8�?� '�$�&�&� &� �8� #� #� %� %� 0�-�/�/� /� � � $�S�]� $��.�.� � �z�z��z�/�/�B�=�?�?�Br<r3c� �|jsdS|jrt�d��dS|js|jst�d|��dSt |j��}t|j ��}t� d||j ��|j � dd��d} t|||j��S#t $rt�d|��YdSwxYw) z-Fetch metadata using lazy wheel, if possible.Nz3Lazy wheel is not used as hash checking is requiredz>Lazy wheel is not used as %r does not points to a remote wheelz+Obtaining dependency information from %s %s�#�rz"%s does not support range requests)r�r�r]�debugr{r|rr�r�namer��versionr6�splitrr�r)rDr3�wheelr�r6s r1� _fetch_metadata_using_lazy_wheelz4RequirementPreparer._fetch_metadata_using_lazy_wheel�s�� �"� ��4� � � � �L�L�N� O� O� O��4� �<� �t�}� � �L�L�P�� � � ��4��d�m�$�$�� ���,�,��� � � 9� � �M� � � � �h�n�n�S�!�$�$�Q�'�� �&�t�S�$�-�@�@� @��*� � � � �L�L�=�s� C� C� C��4�4� ���s�C�%D�DF�partially_downloaded_reqsc�X�tdd���j}i}|D]}|jsJ�|||j<�|�|���|��}|D]3\}\}} t �d||��||}||_�4|D]}|�||���dS)z>Download any requirements which were only fetched by metadata.r9TrOzDownloading link %s to %sN) r$r?r3r��keysr]r��local_file_path�_prepare_linked_requirement) rDr�r�rT�links_to_fully_downloadr'�batch_downloadr3�filepath�_s r1�_complete_partial_requirementsz2RequirementPreparer._complete_partial_requirements�s���!�h��F�F�F�K�� CE��,� 4� 4�C��8�O�O�8�03� #�C�H� -� -��-�-� #� (� (� *� *� � � ��$2� +� +� �D�-�8�Q� �L�L�4�d�H� E� E� E�)�$�/�C�"*�C� � �-� C� C�C� � ,� ,�S�/� B� B� B� B� C� Cr<c���|jsJ�|j}|�|��t��5d}|j�7|jr0|�|��}t |j|j|��}|�||j|jj<n,|� |��}|�d|_ |cddd��S|� ||��cddd��S#1swxYwYdS)z3Prepare a requirement to be obtained from req.link.NT) r3r�rrLr|r�rRr�r6r��needs_more_preparationr�)rDr'r�r3rurM� wheel_dists r1�prepare_linked_requirementz.RequirementPreparer.prepare_linked_requirement�sq���x���x��x�� � � ��%�%�%� �\�\� J� J��I�� �,���,��4�4�S�9�9��/���$�:K�V�T�T� ��$�1:�� ����.�.�"�B�B�4�H�H� ��)�15�C�.�%�! J� J� J� J� J� J� J� J�&�3�3�C��I�I�' J� J� J� J� J� J� J� J� J� J� J� J���� J� J� J� J� J� Js�A7C�8C�C�!C�reqsc��d�|D��}|D]b}|j�Y|jjrM|�|��}t |j|j|��}|�||j|jj<d|_�cg}|D]5}|jr|�|���|� ||���6|� ||���dS)z,Prepare linked requirements more, if needed.c� �g|] }|j� |�� SrJ)r�)�.0r's r1� zHRequirementPreparer.prepare_linked_requirements_more..�s ��B�B�B��s�'A�B��B�B�Br<NF)r�) rLr3r|r�rRr�r6r��appendr�r�)rDr�r�r'rMrur�s r1� prepare_linked_requirements_morez4RequirementPreparer.prepare_linked_requirements_more�s��C�B�t�B�B�B��� 7� 7�C�� �,���1B�,��4�4�S�9�9��/���$�:K�V�T�T� ��(�5>�D�$�S�X�\�2�16�C�.��?A�!�� G� G�C��)� G�)�0�0��5�5�5�5��0�0��o�F�F�F�F� �+�+� %�+� ,� � � � � r<c�Z�|jsJ�|j}|�||��|�|��}|���r |jrd}n�|j|jvrZ t||j|j |j |��}np#t$r)}td� |||�����d}~wwxYw|j|j}|r|�|��t|d���}|r |j|_t%||j|j|j��}|S)NzDCould not install requirement {} because of HTTP error {} for URL {})r@)r3r�r�ryr�r6r�r~r�r�rLrr r�rSr>r?r�r2r(r)r*) rDr'r�r3rM� local_file�excru�dists r1r�z/RequirementPreparer._prepare_linked_requirementsb���x���x��x�� �%�%�c�?�;�;�;��,�,�S�1�1�� � � � !� !� <�d�&8� <��J�J� �X�T�-� -� -� �'��#�.�$�.�$�:K�V��� � ��*� � � �'�*�*0�&��c�4�*@�*@�������� ���� �(���2�I�� 5��)�)�)�4�4�4��i�d�;�;�;�J� � 2�",�/�C� �)� � � � �K� � �  � �� � s�)"B � B?�$B:�:B?c�F�|j�J�|j�J�|j}|js|���r#|jr|�|j��dS|���rt �d|��dS|j�dStj � |j|j ��}tj � |��sFtj|j|��t!|��}t �d|��dSdS)NzENot copying link to destination directory since it is a directory: %szSaved %s)rLr3rxry�editable�archiver]r�r�rgr?r�r�r�r[�copyr r�)rDr'r3�download_locationr�s r1�save_linked_requirementz+RequirementPreparer.save_linked_requirement*s'��� �,�,�,��x�#�#�#��x�� �;� �4�/�/�1�1� �c�l� � �K�K��)� *� *� *� �F� � � � !� !� � �L�L�.�� � � � �F� � � &� �F��G�L�L��):�D�M�J�J���w�~�~�/�0�0� 3� �K��+�->� ?� ?� ?�(�):�;�;�M� �K�K� �M� 2� 2� 2� 2� 2� 3� 3r<c���|js Jd���t�d|��t��5|jr"t d�|�����|�|j��|� ��t||j |j |j ��}|�|j��ddd��n #1swxYwY|S)z Prepare an editable requirement.z-cannot prepare a non-editable req as editablez Obtaining %szoThe editable requirement {} cannot be installed when requiring hashes, because there is no single file to hash.N)r�r]r�rr�r r�r�r��update_editabler2r(r)r*�check_if_existsr�)rDr'r�s r1�prepare_editable_requirementz0RequirementPreparer.prepare_editable_requirementDs'�� �|�L�L�L�L�L�|�� � �N�C�(�(�(� �\�\� 4� 4��"� �'��"�F�3�K�K���� � %� %�d�l� 3� 3� 3� � � � !� !� !�-��� �� ��$� ��D� � � �� 2� 3� 3� 3�# 4� 4� 4� 4� 4� 4� 4� 4� 4� 4� 4���� 4� 4� 4� 4�&� s�BC�C�!C� skip_reasonc��|js Jd���|�"Jd�|j�����t�d|||jj��t ��5|jrt�d��t|��� ��cddd��S#1swxYwYdS)z)Prepare an already-installed requirement.z(req should have been satisfied but isn'tNzAdid 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_byr�r]r�r�rr�r�r r/)rDr'r�s r1�prepare_installed_requirementz1RequirementPreparer.prepare_installed_requirementbs/�� ��K�K�!K�K�K���&�&� �!�6�#�"2�3�3�'�&�&� � � � %�{�C��9I�9Q� � � ��\�\� J� J��"� �� � �(���� )��-�-�G�G�I�I� J� J� J� J� J� J� J� J� J� J� J� J���� J� J� J� J� J� Js�+AB:�:B>�B>)F)rFrGrH�__doc__rIr�boolrrrrErr�r�rr�rrr�rr�r�r�r�r�r�r�� __classcell__)r�s@r1r�r��s�������� � �05��05��s�m�05�� 05� � 05� (� 05��05��05��05��05��05��05��05� �05�05�05�05�05�05�dB�'9�B�d�B�B�B�B�"#�%�#�8<�#� �#�#�#�#�JC�*<�C��C�C�C�C�@��� �"� #�����D!&�C�C�#+�,>�#?�C��C� � C�C�C�C�B@E�J�J�%�J�8<�J� �J�J�J�J�:KP� � ��/�0� �CG� � � � � � �<&�%�&�8<�&� �&�&�&�&�P3�+=�3�$�3�3�3�3�4� �� �����<J� �J��J� � J�J�J�J�J�J�J�Jr<r�)NN)Mr��loggingrBrgr[�typingrrrr�pip._vendor.packaging.utilsr�pip._internal.distributionsr�%pip._internal.distributions.installedr �pip._internal.exceptionsr r r r rrr�"pip._internal.index.package_finderr�pip._internal.metadatar�pip._internal.models.linkr�pip._internal.models.wheelr�pip._internal.network.downloadrr� pip._internal.network.lazy_wheelrr�pip._internal.network.sessionr�pip._internal.req.req_installr�pip._internal.req.req_trackerr�pip._internal.utils.filesystemr�pip._internal.utils.hashesrr�pip._internal.utils.loggingr�pip._internal.utils.miscr r!r"r#�pip._internal.utils.temp_dirr$�pip._internal.utils.unpackingr%�pip._internal.vcsr&� getLoggerrFr]r�r2rIr;r>rWr`rsrvr~rRr�rJr<r1�r�s����� �������� � � � � � � � �1�1�1�1�1�1�1�1�1�1�1�1�9�9�9�9�9�9�Q�Q�Q�Q�Q�Q�G�G�G�G�G�G�������������������=�<�<�<�<�<�3�3�3�3�3�3�*�*�*�*�*�*�,�,�,�,�,�,�F�F�F�F�F�F�F�F���������5�4�4�4�4�4�<�<�<�<�<�<�<�<�<�<�<�<�6�6�6�6�6�6�<�<�<�<�<�<�<�<�2�2�2�2�2�2�W�W�W�W�W�W�W�W�W�W�W�W�6�6�6�6�6�6�5�5�5�5�5�5�!�!�!�!�!�!� �� �8� $� $�� 5� � 5�#� 5� � 5�� 5� � 5� 5� 5� 5�9�$�9�#�9�$�9�9�9�9� -�-�-�-�-�-�-�-�#'�#� )�)� �)��)��3�-�)� �V� � )�  � )�)�)�)�0 �s� �#� �$� � � � �(�c��3��4�����<PT�!�!� �!�&�s�m�!�