Current File : //lib/python3.9/site-packages/pip/_vendor/pep517/__pycache__/check.cpython-39.pyc
a

[��f��@s�dZddlZddlZddlZddlZddlmZmZddl	Z	ddl
mZddlZddl
Z
ddlmZddlZddlmZddlmZmZdd	lmZdd
lmZe�e�Zdd�Zd
d�Zdd�Zddd�Z ddddd�Z!dd�Z"edkr�e �dS)zHCheck a project and backend by attempting to build using PEP 517 hooks.
�N)�isfile�join)�CalledProcessError)�mkdtemp�)�enable_colourful_output)�TOMLDecodeError�	toml_load)�BuildEnvironment)�Pep517HookCallerc
CsHt���*}z|�|�t�d�Wn*tyLt�d�YWd�dS0z|�i�}t�d|�Wn.ty�tjddd�YWd�dS0z|�|�t�d�Wn*ty�t�d	�YWd�dS0t�}t�d
|��z$z|�	|i�}t�d|�Wn<t�yJtjddd�YWt
�|�Wd�dS0|�d
��s�t�d|�Wt
�|�Wd�dSt
||�}t|��r�t�d|�n(t�d|�Wt
�|�Wd�dSt�|��r�t�d�n&t�d�Wt
�|�Wd�dSWt
�|�nt
�|�0Wd�dS1�s:0YdS)N�#Installed static build dependencies�+Failed to install static build dependenciesF�Got build requires: %s�'Failure in get_requires_for_build_sdistT��exc_info�$Installed dynamic build dependencies�,Failed to install dynamic build dependencieszTrying to build sdist in %szbuild_sdist returned %rzFailure in build_sdistz.tar.gzz*Filename %s doesn't have .tar.gz extension�Output file %s exists�Output file %s does not existzOutput file is a tar filezOutput file is not a tar file)r
�pip_install�log�infor�errorZget_requires_for_build_sdist�	ExceptionrZbuild_sdist�shutil�rmtree�endswith�pjoinr�tarfileZ
is_tarfile��hooksZbuild_sys_requires�envZreqsZtd�filename�path�r%�</usr/lib/python3.9/site-packages/pip/_vendor/pep517/check.py�check_build_sdistsh






��
�

	
�

�r'c
CsHt���*}z|�|�t�d�Wn*tyLt�d�YWd�dS0z|�i�}t�d|�Wn.ty�tjddd�YWd�dS0z|�|�t�d�Wn*ty�t�d	�YWd�dS0t�}t�d
|��z$z|�	|i�}t�d|�Wn<t�yJtjddd�YWt
�|�Wd�dS0|�d
��s�t�d|�Wt
�|�Wd�dSt
||�}t|��r�t�d|�n(t�d|�Wt
�|�Wd�dSt�|��r�t�d�n&t�d�Wt
�|�Wd�dSWt
�|�nt
�|�0Wd�dS1�s:0YdS)Nrr
FrrTrrrzTrying to build wheel in %szbuild_wheel returned %rzFailure in build_wheelz.whlz'Filename %s doesn't have .whl extensionrrzOutput file is a zip filezOutput file is not a zip file)r
rrrrrZget_requires_for_build_wheelrrZbuild_wheelrrrrr�zipfile�
is_zipfiler r%r%r&�check_build_wheelPsd






�
�

	
�

�r*c	Cs�t|d�}t|�rt�d�nt�d�dSzdt�|d��}t|�}Wd�n1sX0Y|d}|d}|d}|�d	�}t�d
�Wn&t	t
fy�tjddd
�YdS0t|||�}t||�}	t
||�}
|	s�t�d�|
s�t�d�|	S)Nzpyproject.tomlzFound pyproject.tomlzMissing pyproject.tomlF�rbzbuild-system�requiresz
build-backendzbackend-pathzLoaded pyproject.tomlzInvalid pyproject.tomlTrz%Sdist checks failed; scroll up to seezWheel checks failed)rrrrr�io�openr	�getr�KeyErrorrr'r*�warning)�
source_dirZ	pyproject�fZpyproject_dataZbuildsysr,ZbackendZbackend_pathr!Zsdist_okZwheel_okr%r%r&�check�s0

&




r4cCsjt�d�t��}|jddd�|�|�}t�t|j�}|rNt	t
dd��nt	t
dd��t�d	�dS)
NzQpep517.check is deprecated. Consider switching to https://pypi.org/project/build/r2z%A directory containing pyproject.toml)�helpz
Checks passed�greenz
Checks failed�redr)
rr1�argparse�ArgumentParser�add_argument�
parse_argsrr4r2�print�ansi�sys�exit)�argvZap�args�okr%r%r&�main�s
�

rCzzzz)�resetZboldr7r6cCs8tjdkr,tj��r,t|t|�tdSt|�SdS)N�ntrD)�os�namer>�stdout�isatty�
ansi_codes�str)�s�attrr%r%r&r=�sr=�__main__)N)#�__doc__r8r-ZloggingrFZos.pathrrrr�
subprocessrr>rZtempfilerr(Zcolorlogr�compatrr	Zenvbuildr
ZwrappersrZ	getLogger�__name__rr'r*r4rCrJr=r%r%r%r&�<module>s8
98"
�