� ��^i�����UddlZddlZddlZddlZddlZddlmZmZddl m Z m Z m Z m Z mZmZddlmZmZeje��Zedd���Zedd d � ��Zdae eed <ed e dfd���ZGd�d��Zdae eed<ed e efd���ZGd�d��Ze��ZGd�d��Z Gd�de ��Z!dS)�N)� ExitStack�contextmanager)�Any�Dict�Iterator�Optional�TypeVar�Union)�enum�rmtree�_T� TempDirectory)�boundz build-envzephem-wheel-cachez req-build)� BUILD_ENV�EPHEM_WHEEL_CACHE� REQ_BUILD�_tempdir_manager�returnc#�K�t��5}t|c}a dV�|an#|awxYw ddd��dS#1swxYwYdS�N)rr)�stack�old_tempdir_managers ��/builddir/build/BUILDROOT/alt-python311-pip-21.3.1-4.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_internal/utils/temp_dir.py�global_tempdir_managerrs����� ���3��0@�%�-��-� 3� �E�E�E�2� � ��2� � 2� 2� 2� 2� � 3�3�3�3�3�3�3�3�3�3�3�3����3�3�3�3�3�3s� 9�$�9�(�9�=�=c�>�eZdZdZd d�Zdededdfd�Zdedefd�ZdS) �TempDirectoryTypeRegistryzManages temp directory behaviorrNc��i|_dSr��_should_delete��selfs r�__init__z"TempDirectoryTypeRegistry.__init__*s��/1������kind�valuec��||j|<dS)z[Indicate whether a TempDirectory of the given kind should be auto-deleted. Nr)r!r$r%s r� set_deletez$TempDirectoryTypeRegistry.set_delete-s��%*���D�!�!�!r#c�8�|j�|d��S)z^Get configured auto-delete flag for a given TempDirectory type, default True. T)r�get)r!r$s r� get_deletez$TempDirectoryTypeRegistry.get_delete3s���"�&�&�t�T�2�2�2r#�rN) �__name__� __module__� __qualname__�__doc__r"�str�boolr'r*�r#rrr'sy������)�)�2�2�2�2�*�s�*�4�*�D�*�*�*�*� 3�s�3�t�3�3�3�3�3�3r#r�_tempdir_registryc#�ZK�t}t��a tV�|adS#|awxYw)zuProvides a scoped global tempdir registry that can be used to dictate whether directories should be deleted. N)r3r)�old_tempdir_registrys r�tempdir_registryr6=sJ���� -��1�3�3��1�����0�����0��0�0�0�0s� &�*c��eZdZdS)�_DefaultN)r,r-r.r2r#rr8r8Ks�������Dr#r8c ����eZdZdZdeddfdeedeede fdedef�fd � Z e d efd ���Z d efd �Z d ed efd�Zdededed dfd�Zded efd�Zdd�Z�xZS)raMHelper class that owns and cleans up a temporary directory. This class can be used as a context manager or as an OO representation of a temporary directory. Attributes: path Location to the created temporary directory delete Whether the directory should be deleted when exiting (when used as a contextmanager) Methods: cleanup() Deletes the temporary directory When used as a context manager, if the delete attribute is True, on exiting the context the temporary directory is deleted. N�tempF�path�deleter$�globally_managedc���t�����|tur|�d}nd}|�|�|��}||_d|_||_||_|r%t�J�t� |��dSdS)NF) �superr"�_default�_create�_path�_deletedr<r$r� enter_context)r!r;r<r$r=� __class__s �rr"zTempDirectory.__init__gs���� �������� �X� � �������� �<��<�<��%�%�D��� ��� ��� ��� � � 1�#�/�/�/� � *� *�4� 0� 0� 0� 0� 0� 1� 1r#rc�B�|jrJd|j�����|jS)Nz"Attempted to access deleted path: )rCrBr s rr;zTempDirectory.path�s+���=�S�S�"S�t�z�"S�"S�S�S� ��z�r#c�2�d|jj�d|j�d�S)N�<� �>)rEr,r;r s r�__repr__zTempDirectory.__repr__�s"��;�4�>�*�;�;�T�Y�;�;�;�;r#r!c��|Srr2r s r� __enter__zTempDirectory.__enter__�s��� r#�excr%�tbc��|j�|j}n)tr t�|j��}nd}|r|���dSdS)NT)r<r3r*r$�cleanup)r!rNr%rOr<s r�__exit__zTempDirectory.__exit__�sZ�� �;� "��[�F�F� � �&�1�1�$�)�<�<�F�F��F� � � �L�L�N�N�N�N�N� � r#c��tj�tjd|�d������}t �d|��|S)z���t�#�#�"�N�N�N��  #��s�3�,�-�-�.�.� #� #�A�&�D��!�1��� #� #� ������!3�!3�3�d�:���t�#�#�"�N�N�N��  #� #� #r#r$c�*�tj�|j��\}}|�|��D]�}tj�||��} tj|��tj�|��}nc#t$r }|j tj kr�Yd}~�}d}~wwxYwtj�tj d|�d������}t�d|��|S)NrTrUrVrX)rYr;�splitrfrxrs�mkdirrZ�OSError�errno�EEXISTr[r\r]r^)r!r$�rootrirvr;�exs rrAzAdjacentTempDirectory._create�s���W�]�]�4�=�1�1� ��d��-�-�d�3�3� M� M�I��7�<�<��i�0�0�D� ������� �w�'�'��-�-����� � � � ��8�u�|�+�+��,�+�+�+�+����� �����7�#�#�H�$4�N�4�N�N�N�$K�$K�$K�L�L�D�� � �6��=�=�=�� s� B� B?�B:�:B?r)r,r-r.r/rrr0rr1r"� classmethodrrxrArbrcs@rrere�s�������� � �&&�M�(�(��(�h�t�n�(��(�(�(�(�(�(��#�3�#�8�C�=�#�#�#��[�#�2�C��C��������r#re)"r}rp�logging�os.pathrYr[� contextlibrr�typingrrrrr r �pip._internal.utils.miscr r � getLoggerr,r]r � tempdir_kindsr�__annotations__rrr3r6r8r@rrer2r#r�r�s3�� � � � � �����������������0�0�0�0�0�0�0�0�@�@�@�@�@�@�@�@�@�@�@�@�@�@�@�@�1�1�1�1�1�1�1�1� �� �8� $� $�� �W�T��)�)�)�� ���)����� �)-��(�9�%�,�,�,��3����3�3�3���3�3�3�3�3�3�3�3�3�&:>��8�5�6�=�=�=�� 1�(�#<�=� 1� 1� 1��� 1� � � � � � � � � �8�:�:��[�[�[�[�[�[�[�[�|F�F�F�F�F�M�F�F�F�F�Fr#