U ʗRe @ s d Z ddlZddlZddlZddlZddlZddlmZ ddlm Z ddl mZmZ ddl mZmZ eeZdd Zd d Zdd Zdd Zd"ddZe Zejddd ejddddd ejddddd ejdddd dd Zed!kr ee dS )#z%Build a project using PEP 517 hooks. N )BuildEnvironment)Pep517HookCaller)tempdirmkdir_p)FileNotFoundError toml_loadc C s4 ddh}|t | ks0dj|t | d}t|dS )z7 Ensure build system has the requisite fields. requires build-backendz"Missing required fields: {missing})missingN)setformat ValueError)systemrequiredmessage r /builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/pep517/build.pyvalidate_system s r c C s6 t j| d}t|d}t|}W 5 Q R X |d S )zC Load the build system from a source dir (pyproject.toml). zpyproject.tomlrbzbuild-system)ospathjoinioopenr ) source_dir pyprojectfZpyproject_datar r r load_system s r c C sJ zt | }W n ttfk r( i }Y nX |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 setuptoolswheel)r r KeyError setdefault)r r r r r compat_system' s r# c C s dj f t }t| |}|i }td| || td t b}td|| dj f t }t| |} | |i } tj || }t |tj |tj| W 5 Q R X d S )Nzget_requires_for_build_{dist}zGot build requires: %sz$Installed dynamic build dependencieszTrying to build %s in %szbuild_{dist}) r localsgetattrloginfopip_installr r r r shutilmovebasename)hooksenvdistdestZget_requires_nameget_requiresreqstdZ build_namebuildfilenamesourcer r r _do_build: s r6 c C sv |p t | }tj| |pd}t| t| t| |d |d}t "}| |d t |||| W 5 Q R X d S )Nr. r zbackend-pathr )r r r r r r r getr r( r6 )r r. r/ r r, r- r r r r3 L s r3 r z%A directory containing pyproject.toml)helpz--binaryz-b store_trueF)actiondefaultz--sourcez-sz --out-dirz-oz>Destination in which to save the builds relative to source dirc C sZ t d ttd | js| js dnd | js.| js2dnd f}|D ]}t| j|| j q@d S )NzQpep517.build is deprecated. Consider switching to https://pypi.org/project/build/sdistr ) r&