� ��^iu4��`�ddlZddlmZddlZddlmZmZddlZddl m Z m Z m Z ddl Z ddlmZddlmZddlmZgd �Zed ���ZGd �d e��ZGd �de��ZGd�de��ZGd�de��Zdd�Zdd�Zd�ZGd�de��ZGd�dej ��Z!dS)�N)�contextmanager)�abspath�join)� check_call� check_output�STDOUT)�mkdtemp�)�compat)�_in_proc_script_path)�BackendUnavailable�BackendInvalid� HookMissing�UnsupportedOperation�default_subprocess_runner�quiet_subprocess_runner�Pep517HookCallerc#�K�t��} |V�tj|��dS#tj|��wxYw�N)r �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/wrappers.py�tempdirrsI���� ���B������� �b�������� �b�������s �,�Ac��eZdZdZd�ZdS)r zEWill be raised if the backend cannot be imported in the hook process.c��||_dSr�� traceback��selfrs r�__init__zBackendUnavailable.__init__#� ��"�����N��__name__� __module__� __qualname__�__doc__r!�r#rr r !s)������O�O�#�#�#�#�#r#r c��eZdZdZd�ZdS)rz)Will be raised if the backend is invalid.c�0�||_||_||_dSr�� backend_name� backend_path�message)r r-r.r/s rr!zBackendInvalid.__init__)s��(���(����� � � r#Nr$r)r#rrr's)������3�3�����r#rc�"��eZdZdZ�fd�Z�xZS)rz Will be raised on missing hooks.c�f��tt|���|��||_dSr)�superrr!� hook_name)r r3� __class__s �rr!zHookMissing.__init__1s,��� �k�4� � �)�)�)�4�4�4�"����r#)r%r&r'r(r!� __classcell__)r4s@rrr/s>�������*�*�#�#�#�#�#�#�#�#�#r#rc��eZdZdZd�ZdS)rzDMay be raised by build_sdist if the backend indicates that it can't.c��||_dSrrrs rr!zUnsupportedOperation.__init__8r"r#Nr$r)r#rrr6s)������N�N�#�#�#�#�#r#rc��tj���}|r|�|��t |||���dS)z5The default method of calling the wrapper subprocess.)�cwd�envN)�os�environ�copy�updater��cmdr9� extra_environr:s rrr<sH�� �*�/�/� � �C��"� � � �=�!�!�!��s���%�%�%�%�%�%r#c��tj���}|r|�|��t |||t ���dS)zDA method of calling the wrapper subprocess while suppressing output.)r9r:�stderrN)r;r<r=r>rrr?s rrrEsJ�� �*�/�/� � �C��"� � � �=�!�!�!���#�3�v�6�6�6�6�6�6r#c���tj�|��rtd���tj�|��}tj�tj�||����}tj�|��}tj�|��}tj�||g��|krtd���|S)z�Normalise and check a backend path. Ensure that the requested backend path is specified as a relative path, and resolves to a location under the given source tree. Return an absolute version of the requested path. zpaths must be relativez paths must be inside source tree) r;�path�isabs� ValueErrorr�normpathr�normcase� commonprefix)� source_tree� requested� abs_source� abs_requested� norm_source�norm_requesteds r�norm_and_checkrQNs��� �w�}�}�Y���3��1�2�2�2������-�-�J��G�$�$�R�W�\�\�*�i�%H�%H�I�I�M��'�"�"�:�.�.�K��W�%�%�m�4�4�N� �w���[�.�9�:�:�k�I�I��;�<�<�<� �r#c��eZdZdZ dd�Zed���Zd�Zdd�Z dd�Z dd �Z dd �Z dd �Z dd �Z dd �Zdd�Zd�ZdS)ra�A wrapper around a source directory to be built with a PEP 517 backend. :param source_dir: The path to the source directory, containing pyproject.toml. :param build_backend: The build backend spec, as per PEP 517, from pyproject.toml. :param backend_path: The backend path, as per PEP 517, from pyproject.toml. :param runner: A callable that invokes the wrapper subprocess. :param python_executable: The Python executable used to invoke the backend The 'runner', if provided, must expect the following: - cmd: a list of strings representing the command and arguments to execute, as would be passed to e.g. 'subprocess.check_call'. - cwd: a string representing the working directory that must be used for the subprocess. Corresponds to the provided source_dir. - extra_environ: a dict mapping environment variable names to values which must be set for the subprocess execution. Nc���|�t}t|���_|�_|r�fd�|D��}|�_|�_|s t j}|�_dS)Nc�:��g|]}t�j|����Sr))rQ� source_dir)�.0�pr s �r� z-Pep517HookCaller.__init__..�s2������78��t���2�2���r#) rrrU� build_backendr.�_subprocess_runner�sys� executable�python_executable)r rUrYr.�runnerr]s` rr!zPep517HookCaller.__init__zs���� �>�.�F�!�*�-�-���*��� � �����Return the list of optional features supported by the backend.�_supported_features�� _call_hook�r s rrcz$Pep517HookCaller._supported_features�s�����4�b�9�9�9r#c�2�|�dd|i��S)aIIdentify packages required for building a wheel Returns a list of dependency specifications, e.g.:: ["wheel >= 0.25", "setuptools"] This does not include requirements specified in pyproject.toml. It returns the result of calling the equivalently named hook in a subprocess. �get_requires_for_build_wheel�config_settingsrd�r ris rrhz-Pep517HookCaller.get_requires_for_build_wheel��(�����=� ��@ � � � r#Tc�P�|�dt|��||d���S)auPrepare a ``*.dist-info`` folder with metadata for this project. Returns the name of the newly created folder. If the build backend defines a hook with this name, it will be called in a subprocess. If not, the backend will be asked to build a wheel, and the dist-info extracted from that (unless _allow_fallback is False). � prepare_metadata_for_build_wheel��metadata_directoryri�_allow_fallback�rer�r rorirps rrmz1Pep517HookCaller.prepare_metadata_for_build_wheel�s;�����A�")�*<�"=�"=�.�.�D �D � � � r#c�r�|�t|��}|�dt|��||d���S)avBuild a wheel from this project. Returns the name of the newly created file. In general, this will call the 'build_wheel' hook in the backend. However, if that was previously called by 'prepare_metadata_for_build_wheel', and the same metadata_directory is used, the previously built wheel will be copied to wheel_directory. N� build_wheel��wheel_directoryriro�rre�r rvriros rrtzPep517HookCaller.build_wheel�sL�� � )�!(�);�!<�!<� ����}�&��7�7�.�"4�/ �/ � � � r#c�2�|�dd|i��S)aSIdentify packages required for building an editable wheel Returns a list of dependency specifications, e.g.:: ["wheel >= 0.25", "setuptools"] This does not include requirements specified in pyproject.toml. It returns the result of calling the equivalently named hook in a subprocess. �get_requires_for_build_editablerirdrjs rrzz0Pep517HookCaller.get_requires_for_build_editable�s(�����@� ��C � � � r#c�P�|�dt|��||d���S)aPrepare a ``*.dist-info`` folder with metadata for this project. Returns the name of the newly created folder. If the build backend defines a hook with this name, it will be called in a subprocess. If not, the backend will be asked to build an editable wheel, and the dist-info extracted from that (unless _allow_fallback is False). �#prepare_metadata_for_build_editablernrqrrs rr|z4Pep517HookCaller.prepare_metadata_for_build_editable�s;�����D�")�*<�"=�"=�.�.�G �G � � � r#c�r�|�t|��}|�dt|��||d���S)a�Build an editable wheel from this project. Returns the name of the newly created file. In general, this will call the 'build_editable' hook in the backend. However, if that was previously called by 'prepare_metadata_for_build_editable', and the same metadata_directory is used, the previously built wheel will be copied to wheel_directory. N�build_editablerurwrxs rr~zPep517HookCaller.build_editable�sM�� � )�!(�);�!<�!<� ����/�&��7�7�.�"4�2 �2 � � � r#c�2�|�dd|i��S)a>Identify packages required for building a wheel Returns a list of dependency specifications, e.g.:: ["setuptools >= 26"] This does not include requirements specified in pyproject.toml. It returns the result of calling the equivalently named hook in a subprocess. �get_requires_for_build_sdistrirdrjs rr�z-Pep517HookCaller.get_requires_for_build_sdist rkr#c�N�|�dt|��|d���S)z�Build an sdist from this project. Returns the name of the newly created file. This calls the 'build_sdist' backend hook in a subprocess. � build_sdist)�sdist_directoryrirq)r r�ris rr�zPep517HookCaller.build_sdists4�����}�&��7�7�.�/ �/ � � � r#c ���tjddkr|j�d��}n|j}d|i}|jret j�|j��}tjddkr&|�tj����}||d<t��5}d|i}tj |t|d��d���t��5}|j} |�| t!t#|����||g|j|� ��ddd��n #1swxYwYtjt|d ����} | �d ��r#t+| �d d �����| �d��r#t-| �d d �����| �d��r0t/|j|j| �dd ������| �d��r$t1| �d��p|���| dcddd��S#1swxYwYdS)Nr��ASCII�PEP517_BUILD_BACKEND�PEP517_BACKEND_PATH�kwargsz input.json)�indent)r9rAz output.json� unsupportedr�� no_backend�backend_invalid� backend_errorr,� hook_missing�missing_hook_name� return_val)r[� version_inforY�encoder.r;�pathsepr�getfilesystemencodingrr � write_json�pjoinr r]rZr�strrU� read_json�getrr rr) r r3r�rYrAr.r� hook_input�script�python�datas rrezPep517HookCaller._call_hook&s��� � �A� �!� #� #� �.�5�5�g�>�>�M�M� �.�M�/��?� � � � @��:�?�?�4�+<�=�=�L����"�a�'�'�+�2�2�3�3L�3N�3N�O�O� �3?�M�/� 0� �Y�Y� &�"�"�F�+�J� � �j�%��L�*A�*A�%&� (� (� (� (�&�'�'� �6��/���'�'��W�S��[�[�1�1�9�b�A���"/�(���� � � � � � � � � � � ���� � � � ��#�E�"�m�$<�$<�=�=�D��x�x� �&�&� F�*�4�8�8�K��+D�+D�E�E�E��x�x� �%�%� D�(����+�r�)B�)B�C�C�C��x�x�)�*�*� �$�!%�!3�!%�!2� �H�H�_�b�9�9����� �x�x��'�'� N�!�$�(�(�+>�"?�"?�"L�9�M�M�M�� �%�7 &� &� &� &� &� &� &� &� &� &� &� &���� &� &� &� &� &� &s8�78I-�/AD>�2 I-�>E �I-�E �DI-�-I1�4I1)NNNr�NT�NN)r%r&r'r(r!rrarcrhrmrtrzr|r~r�r�rer)r#rrrfs6��������.��"� 3�3�3�3�.� +� +��^� +�:�:�:�  �  �  �  � 7;� � � � � �&48�#� � � � �(  �  �  �  � 7;� � � � � �&48�#� � � � �(  �  �  �  �  �  �  �  �/&�/&�/&�/&�/&r#rc�@�eZdZdZd�Zd�Zed���Zd�Zd�Z dS)� LoggerWrapperzd Read messages from a pipe and redirect them to a logger (see python's logging module). c��tj�|��d|_||_||_t j��\|_|_ t j |j��|_ |� ��dSr�) � threading�Threadr!�daemon�logger�levelr;�pipe�fd_read�fd_write�fdopen�reader�start)r r�r�s rr!zLoggerWrapper.__init__^sh����!�!�$�'�'�'��� ��� ��� �')�g�i�i�#�� �d�m��i�� �-�-�� � � � � � � � � r#c��|jSr)r�rfs r�filenozLoggerWrapper.filenoks ���}�r#c�X�|�tj��r |dd�n|S)N�����)�endswithr;�linesep)�msgs r�remove_newlinezLoggerWrapper.remove_newlinens'���<�<�� �3�3�<�s�3�B�3�x�x��r�s������%�%�%�%�%�%� � � � �*�*�*�*�*�*�*�*� � � � �7�7�7�7�7�7�7�7�7�7� � � � �������������,�,�,�,�,�,� � � ��������#�#�#�#�#��#�#�#� �����Y����#�#�#�#�#�)�#�#�#�#�#�#�#�#�9�#�#�#� &�&�&�&�7�7�7�7����0o&�o&�o&�o&�o&�v�o&�o&�o&�d-�-�-�-�-�I�$�-�-�-�-�-r#