� ��^ii��j�ddlZddlZddlZddlZddlZddlZddlZejd���Zd�Z d�Z dS)�Nc#�K�tj��} |V�tj|��dS#tj|��wxYw)z2Create a temporary directory in a context manager.N)�tempfile�mkdtemp�shutil�rmtree)�tds ��/builddir/build/BUILDROOT/alt-python311-pip-21.3.1-4.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_vendor/pep517/dirtools.py�tempdirr sP���� � � � �B������� �b�������� �b�������s �1�Ac�� tj|i|��S#t$r!}|jtjkr�Yd}~dSd}~wwxYw)zWLike `mkdir`, but does not raise an exception if the directory already exists. N)�os�mkdir�OSError�errno�EEXIST)�args�kwargs�excs r �mkdir_prsa����x��(��(�(�(�� ���� �9�� � $� $� � %� $� $� $� $� $��������s�� >�9�>c���tj��}tj|d��}t j|��D]�\}}}|D][}tj�||��}tj�||��}|� |dzd���\|D]X}tj�||��}tj�||��}|� ||���Y��|S)z0Construct an in-memory zip file for a directory.�w�/�) �io�BytesIO�zipfile�ZipFiler �walk�path�join�relpath�writestr�write)�root�buffer�zip_file�dirs�filesr�fs_path�rel_paths r �dir_to_zipfiler*s��� �Z�\�\�F���v�s�+�+�H��W�T�]�]�.�.���d�E�� 2� 2�D��g�l�l�4��.�.�G��w���w��5�5�H� � � �h��n�b� 1� 1� 1� 1�� .� .�D��g�l�l�4��.�.�G��w���w��5�5�H� �N�N�7�H� -� -� -� -� .� �O�) r r� contextlibrrrr�contextmanagerr rr*�r+r �r/s��� � � � � � � � ��������� � � � � � � � ����� ���������� � � � � r+