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

[��f�
�@sdZddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZmZddl
mZmZe�e�Zdd	�Zd
d�Zdd
�Zdd�Zd"dd�Ze��Zejddd�ejddddd�ejddddd�ejdddd�dd �Zed!k�ree���dS)#z%Build a project using PEP 517 hooks.
�N�)�BuildEnvironment)�Pep517HookCaller)�tempdir�mkdir_p)�FileNotFoundError�	toml_loadcCs4ddh}|t|�ks0dj|t|�d�}t|��dS)z7
    Ensure build system has the requisite fields.
    �requires�
build-backendz"Missing required fields: {missing})�missingN)�set�format�
ValueError)�system�required�message�r�</usr/lib/python3.9/site-packages/pip/_vendor/pep517/build.py�validate_systems
�rcCsJtj�|d�}t�|d��}t|�}Wd�n1s80Y|dS)zC
    Load the build system from a source dir (pyproject.toml).
    zpyproject.toml�rbNzbuild-system)�os�path�join�io�openr)�
source_dirZ	pyproject�fZpyproject_datarrr�load_systems&rc	CsHzt|�}Wnttfy&i}Yn0|�dd�|�dddg�|S)z�
    Given a source dir, attempt to get a build system backend
    and requirements from pyproject.toml. Fallback to
    setuptools but only if the file was not found or a build
    system was not indicated.
    r
z setuptools.build_meta:__legacy__r	Z
setuptools�wheel)rr�KeyError�
setdefault)rrrrr�
compat_system's
�r!c
Cs�djfit���}t||�}|i�}t�d|�|�|�t�d�t��p}t�d||�djfit���}t||�}	|	|i�}
tj�	||
�}t
�|tj�	|tj�|
���Wd�n1s�0YdS)Nzget_requires_for_build_{dist}zGot build requires: %sz$Installed dynamic build dependencieszTrying to build %s in %szbuild_{dist})
r
�locals�getattr�log�info�pip_installrrrr�shutil�move�basename)�hooks�env�dist�destZget_requires_nameZget_requiresZreqsZtdZ
build_name�build�filename�sourcerrr�	_do_build:s




r1cCs�|p
t|�}tj�||pd�}t|�t|�t||d|�d��}t��,}|�	|d�t
||||�Wd�n1s|0YdS)Nr,r
zbackend-pathr	)rrrrrrr�getrr&r1)rr,r-rr*r+rrrr.Ls�r.rz%A directory containing pyproject.toml)�helpz--binaryz-b�
store_trueF)�action�defaultz--sourcez-sz	--out-dirz-oz>Destination in which to save the builds relative to source dircCsZt�d�ttd|js|js dnd|js.|js2dndf��}|D]}t|j||j�q@dS)NzQpep517.build is deprecated. Consider switching to https://pypi.org/project/build/Zsdistr)	r$Zwarning�list�filterr0Zbinaryr.rZout_dir)�argsZdistsr,rrr�mainps
�r:�__main__)NN)�__doc__�argparserZloggingrr'ZenvbuildrZwrappersrZdirtoolsrr�compatrrZ	getLogger�__name__r$rrr!r1r.�ArgumentParser�parser�add_argumentr:�
parse_argsrrrr�<module>sJ


����