� ��^iJ'���ddlZddlZddlZddlZddlmZmZmZmZm Z m Z m Z m Z ddl mZmZddlmZddlmZmZddlmZerddlmZe e eefZdZd e eeefd efd �Zd e e eefd efd �Zd e e eefd e efd �Zde e eefde ede eded ef d�Z d%de e eefde de eddde eede ede e eefde eede ede e d e e d efd!�Z!d"ed ed#fd$�Z"dS)&�N)� TYPE_CHECKING�Any�Callable�Iterable�List�Mapping�Optional�Union)�SpinnerInterface� open_spinner)�InstallationSubprocessError)�VERBOSE�subprocess_logger)� HiddenText)�Literalz(----------------------------------------�args�returnc��g}|D]B}t|t��r|�|���-|�|���C|S)z& Create a CommandArgs object. )� isinstance�list�extend�append)r� command_args�args ��/builddir/build/BUILDROOT/alt-python311-pip-21.3.1-4.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_internal/utils/subprocess.py� make_commandr!sb��!#�L��%�%�� �c�4� � � %� � � �� $� $� $� $� � � �� $� $� $� $� ��c�@�d�d�|D����S)z/ Format command arguments for display. � c3�K�|]N}t|t��r!tjt |����ntj|��V��OdS)N)rr�shlex�quote�str��.0rs r� z&format_command_args..;sd������ �",�C��!<�!<�R�� �C��H�H����%�+�c�BR�BR������r)�join�rs r�format_command_argsr)2s6�� �8�8������� � �rc��d�|D��S)z= Return the arguments in their raw, unredacted form. c�J�g|] }t|t��r|jn|��!S�)rr�secretr$s r� z'reveal_command_args..Es-�� O� O� O�3�*�S�*�5�5� >�C�J�J�3� O� O� Orr,r(s r�reveal_command_argsr/As�� P� O�$� O� O� O�Or�cmd_args�cwd�lines� exit_statusc��t|��}d�|��}d�|||t|��|t���}|S)z� Create and return the error message to use to log a subprocess error with command output. :param lines: A list of lines, each ending with a newline. �z�Command errored out with exit status {exit_status}: command: {command_display} cwd: {cwd_display} Complete output ({line_count} lines): {output}{divider})r3�command_display� cwd_display� line_count�output�divider)r)r'�format�len� LOG_DIVIDER)r0r1r2r3�commandr9�msgs r�make_subprocess_output_errorr@Hsb��"�(�+�+�G��W�W�U�^�^�F�  C� �f�����u�:�:���  ���� �JrF�raiseT�cmd� show_stdout� on_returncodez"Literal["raise", "warn", "ignore"]�extra_ok_returncodes� command_desc� extra_environ� unset_environ�spinner�log_failed_cmd� stdout_onlyc �R�|�g}|�g}|rtj} tj} ntj} t } tj��| k} | o|du}|�t|��}| d|��tj � ��}|r|� |��|D]}|� |d��� tjt|��tjtj| s tjn tj||d���}n+#t$$r}| rtjd||���d}~wwxYwg}| �s |jsJ�|jsJ�|j��� |j���}|snR|���}|�|dz��| |��|r|sJ�|����n |���|jr|j���n&#|jr|j���wwxYwd�|��}n�|���\}}|���D] }| |���|�|��|���D] }| |���|�|��|}|jo|j|v}|r1|sJ�|r|� d ��n|� d ��|r�|d krE| s.| r,tC||||j� ��}tj"|��tG|j|���|d krtj$d||j|��n|dkrntKd|�����|S)a� Args: show_stdout: if true, use INFO to log the subprocess's stderr and stdout streams. Otherwise, use DEBUG. Defaults to False. extra_ok_returncodes: an iterable of integer return codes that are acceptable, in addition to 0. Defaults to None, which means []. unset_environ: an iterable of environment variable names to unset prior to calling subprocess.Popen(). log_failed_cmd: if false, failed commands are not logged, only raised. stdout_only: if true, return only stdout, else return both. When true, logging of both stdout and stderr occurs when the subprocess has terminated, else logging occurs as subprocess output is produced. NzRunning command %s�backslashreplace)�stdin�stdout�stderrr1�env�errorsz#Error %s while executing command %sT� r5�error�donerA)r0r1r2r3�warnz$Command "%s" had error code %s in %s�ignorezInvalid value: on_returncode=)&r�info�logging�INFO�verboser�getEffectiveLevelr)�os�environ�copy�update�pop� subprocess�Popenr/�PIPE�STDOUT� Exception�criticalrOrN�close�readline�rstripr�spin�waitr'� communicate� splitlines� returncode�finishr@rTr �warning� ValueError)rBrCr1rDrErFrGrHrIrJrK�log_subprocess� used_level�showing_subprocess� use_spinnerrQ�name�proc�exc� all_output�liner9�out�err�out_line�err_line�proc_had_errorr?s r�call_subprocessr�kse��4�#�!����� � ��*�/���\� � �+�2��� �+�<�>�>�*�L��)�(�@�W�D�-@�K���*�3�/�/� ��N�'��6�6�6� �*�/�/� � �C��"� � � �=�!�!�!����� ����d�������� �� $� $��/��?�,7�L�:�$�$�Z�_���%�  �  �  ���� ���� � � � &�5��� � � � ����������J� �#��{���{��z���z� � ������ �� �,�,�.�.�D�� ���;�;�=�=�D� � � �d�T�k� *� *� *� �N�4� � � �� ����w�� � ���� � $� �I�I�K�K�K��{� $�� �!�!�#�#�#����{� $�� �!�!�#�#�#�#� $��������$�$����#�#�%�%���S����(�(� %� %�H� �N�8� $� $� $� $����#�������(�(� %� %�H� �N�8� $� $� $� $����#�������_�T���@T�)T�N��#����w� � #� �N�N�7� #� #� #� #� �N�N�6� "� "� "��P� �G� #� #�%� -�.� -�3� ��$� $�� ���� "�'��,�,�,�-�d�o�|�L�L� L� �f� $� $� � %�6�����  � � � � �h� &� &� ��N�]�N�N�O�O� O� �Ms%�AD� E�"D;�;E�#H�#H;�message).Nc ��� ddttdttdttttfddf�fd� }|S)z�Provide a subprocess_runner that shows a spinner message. Intended for use with for pep517's Pep517HookCaller. Thus, the runner has an API that matches what's expected by Pep517HookCaller.subprocess_runner. NrBr1rGrc�~��t���5}t||||���ddd��dS#1swxYwYdS)N)r1rGrI)r r�)rBr1rGrIr�s �r�runnerz+runner_with_spinner_message..runners���� �'� "� "� �g� ���+��  � � � � � � � � � � � � � � � ���� � � � � � s �2�6�6)NN)rr#r rr)r�r�s` r�runner_with_spinner_messager� so���"�59� � � �#�Y� � �c�]� � ���S�� 1�2� � � � � � � � � �Mr) FNrANNNNNTF)#rYr]r!rb�typingrrrrrrr r �pip._internal.cli.spinnersr r �pip._internal.exceptionsr �pip._internal.utils.loggingrr�pip._internal.utils.miscrrr#� CommandArgsr=rr)r/�intr@�boolr�r�r,rr�r�sB������ � � � � � � � ����� � � � � � � � � � � � � � � � � � � � �F�E�E�E�E�E�E�E�@�@�@�@�@�@�B�B�B�B�B�B�B�B�/�/�/�/�/�/����������5��j��)�*� �9� ���c�:�{�:�;�� �����" �e�D��I�{�$:�;� �� � � � �P�e�D��I�{�$:�;�P��S� �P�P�P�P� ��D��I�{�*�+� � �#�� � ��9� �� �  � � � � �J��:A�48�"&�15�-1�*.�%)�"'�_�_� �t�C�y�+�%� &�_��_� �#��_�8� _� #�8�C�=�1� _� �3�-� _��G�C��H�-�.�_��H�S�M�*�_��&� '�_��T�N�_��$��_� �_�_�_�_�D����)�1D������r