3 ”Re ã@sdZddlZddlZddlZddlmZddlZddlmZddl m Z ddl m Z m Z ddlmZejeƒZd d „Zd d „Zd d„Zdd„Zd#dd„ZejƒZejddd�ejddddd�ejddddd�ejdddd�d d!„Zed"k�reejƒƒdS)$z%Build a project using PEP 517 hooks. éN)Útomlé)ÚBuildEnvironment)ÚPep517HookCaller)ÚtempdirÚmkdir_p)ÚFileNotFoundErrorcCs4ddh}|t|ƒks0dj|t|ƒd�}t|ƒ‚dS)z7 Ensure build system has the requisite fields. Úrequiresz build-backendz"Missing required fields: {missing})ÚmissingN)ÚsetÚformatÚ ValueError)ÚsystemÚrequiredÚmessage©rú‡/builddir/build/BUILDROOT/alt-python36-pip-20.2.4-5.el8.x86_64/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/pep517/build.pyÚvalidate_systems  rc Cs4tjj|dƒ}t|ƒ�}tj|ƒ}WdQRX|dS)zC Load the build system from a source dir (pyproject.toml). zpyproject.tomlNz build-system)ÚosÚpathÚjoinÚopenrÚload)Ú source_dirÚ pyprojectÚfZpyproject_datarrrÚ load_systems rc CsJy t|ƒ}Wnttfk r(i}YnX|jddƒ|jdddgƒ|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. z build-backendz setuptools.build_meta:__legacy__r Ú setuptoolsÚwheel)rrÚKeyErrorÚ setdefault)rrrrrÚ compat_system's  r!c Cs²djftƒŽ}t||ƒ}|iƒ}tjd|ƒ|j|ƒtjdƒtƒ�b}tjd||ƒdjftƒŽ}t||ƒ} | |iƒ} tjj || ƒ} t j | tjj |tjj | ƒƒƒWdQRXdS)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_nameÚ get_requiresÚreqsÚtdZ build_nameÚbuildÚfilenameÚsourcerrrÚ _do_build:s      r4c Csv|p t|ƒ}tjj||pdƒ}t|ƒt|ƒt||d|jdƒƒ}tƒ�"}|j |dƒt ||||ƒWdQRXdS)Nr,z build-backendz backend-pathr ) rrrrrrrÚgetrr&r4)rr,r-rr*r+rrrr1Ls r1rz%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 dircCsXttd|js|j rdnd|js(|j r,dndfƒƒ}x|D]}t|j||jƒqsB