o
    Ëý°jø  ã                   @   sÐ   d dl Z d dlZd dlmZmZ d dlmZ d dlm	Z	 d dl
mZmZ e  e¡Zdee dedefd	d
„Zdee dededee dedee fdd„Zdedededee dee dedee fdd„ZdS )é    N)ÚListÚOptional)Úopen_spinner)Ú make_setuptools_bdist_wheel_args)Úcall_subprocessÚformat_command_argsÚcommand_argsÚcommand_outputÚreturnc                 C   sb   t | ƒ}d|› d�}|s|d7 }|S t ¡ tjkr|d7 }|S | d¡s(|d7 }|d|› �7 }|S )z'Format command information for logging.zCommand arguments: Ú
zCommand output: Nonez'Command output: [use --verbose to show]zCommand output:
)r   ÚloggerÚgetEffectiveLevelÚloggingÚDEBUGÚendswith)r   r	   Úcommand_descÚtext© r   úž/root/aizidognhua/tmp/workspace/projects/ec89d86c-575f-41c9-af57-ac45cbdbf775/venv/lib/python3.10/site-packages/pip/_internal/operations/build/wheel_legacy.pyÚformat_command_result   s   ù
ür   ÚnamesÚtemp_dirÚnamec                 C   st   t | ƒ} | sd |¡}|t||ƒ7 }t |¡ dS t| ƒdkr1d || ¡}|t||ƒ7 }t |¡ tj || d ¡S )z>Return the path to the wheel in the temporary build directory.z1Legacy build of wheel for {!r} created no files.
Né   zZLegacy build of wheel for {!r} created more than one file.
Filenames (choosing first): {}
r   )	ÚsortedÚformatr   r   ÚwarningÚlenÚosÚpathÚjoin)r   r   r   r   r	   Úmsgr   r   r   Úget_legacy_build_wheel_path    s   	

ý
r"   Úsetup_py_pathÚ
source_dirÚglobal_optionsÚbuild_optionsÚtempdc              	   C   sÀ   t ||||d�}d| › d�}t|ƒ�D}t d|¡ z
t|d||d�}	W n ty>   | d¡ t d| ¡ Y W d	  ƒ d	S w t 	|¡}
t
|
|| ||	d
�}|W  d	  ƒ S 1 sYw   Y  d	S )zŒBuild one unpacked package using the "legacy" build process.

    Returns path to wheel if successfully built. Otherwise, returns None.
    )r%   r&   Údestination_dirzBuilding wheel for z (setup.py)zDestination directory: %szpython setup.py bdist_wheel)r   ÚcwdÚspinnerÚerrorzFailed building wheel for %sN)r   r   r   r   r	   )r   r   r   Údebugr   Ú	ExceptionÚfinishr+   r   Úlistdirr"   )r   r#   r$   r%   r&   r'   Ú
wheel_argsÚspin_messager*   Úoutputr   Ú
wheel_pathr   r   r   Úbuild_wheel_legacy;   s@   ü

ü
ó

û$ér4   )r   Úos.pathr   Útypingr   r   Úpip._internal.cli.spinnersr   Ú$pip._internal.utils.setuptools_buildr   Úpip._internal.utils.subprocessr   r   Ú	getLoggerÚ__name__r   Ústrr   r"   r4   r   r   r   r   Ú<module>   sT    
ÿþ
ýÿþýüû
úÿþýüûúù