3 ”ReIã@sìdZddlZddlZddlZddlmZmZddlm Z m Z ddl Z ddl mZddlZddlZddlmZddlZddlmZdd lmZdd lmZejeƒZd d „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)ÚTomlDecodeErrorÚload)ÚCalledProcessError)Úmkdtempé)Úenable_colourful_output)ÚBuildEnvironment)ÚPep517HookCallerc0Cs tƒ��Ž}y|j|ƒtjdƒWntk r@tjdƒdSXy|jiƒ}tjd|ƒWn"tk r~tjddd�dSXy|j|ƒtjdƒWntk r¶tjd ƒdSXtƒ}tjd |ƒzºy|j |iƒ}tjd |ƒWn$tk �r tjd dd�dSX|j d ƒ�s*tjd|ƒdSt ||ƒ}t |ƒ�rLtjd|ƒntjd|ƒdSt j|ƒ�rttjdƒntjdƒdSWdtj|ƒXdSQRXdS)Nz#Installed static build dependenciesz+Failed to install static build dependenciesFzGot build requires: %sz'Failure in get_requires_for_build_sdistT)Úexc_infoz$Installed dynamic build dependenciesz,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 extensionzOutput file %s existszOutput file %s does not existzOutput file is a tar filezOutput file is not a tar file)r Ú pip_installÚlogÚinforÚerrorÚget_requires_for_build_sdistÚ ExceptionrÚ build_sdistÚendswithÚpjoinrÚtarfileÚ is_tarfileÚshutilÚrmtree)ÚhooksÚbuild_sys_requiresÚenvÚreqsÚtdÚfilenameÚpath©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/check.pyÚcheck_build_sdistsV                r#c0Cs tƒ��Ž}y|j|ƒtjdƒWntk r@tjdƒdSXy|jiƒ}tjd|ƒWn"tk r~tjddd�dSXy|j|ƒtjdƒWntk r¶tjd ƒdSXtƒ}tjd |ƒzºy|j |iƒ}tjd |ƒWn$tk �r tjd dd�dSX|j d ƒ�s*tjd|ƒdSt ||ƒ}t |ƒ�rLtjd|ƒntjd|ƒdSt j|ƒ�rttjdƒntjdƒdSWdtj|ƒXdSQRXdS)Nz#Installed static build dependenciesz+Failed to install static build dependenciesFzGot build requires: %sz'Failure in get_requires_for_build_sdistT)r z$Installed dynamic build dependenciesz,Failed to install dynamic build dependencieszTrying to build wheel in %szbuild_wheel returned %rzFailure in build_wheelz.whlz'Filename %s doesn't have .whl extensionzOutput file %s existszOutput file %s does not existzOutput file is a zip filezOutput file is not a zip file)r r rrrrÚget_requires_for_build_wheelrrÚ build_wheelrrrÚzipfileÚ is_zipfilerr)rrrrrrr r!r!r"Úcheck_build_wheelOsT                 r(c Csàt|dƒ}t|ƒrtjdƒntjdƒdSyLt|ƒ�}t|ƒ}WdQRX|d}|d}|d}|jdƒ}tjd ƒWn&tt fk ržtjd d d �dSXt |||ƒ}t ||ƒ} t ||ƒ} | sÎtj d ƒ| sÜtj dƒ| S)Nzpyproject.tomlzFound pyproject.tomlzMissing pyproject.tomlFz build-systemÚrequiresz build-backendz backend-pathzLoaded pyproject.tomlzInvalid pyproject.tomlT)r z%Sdist checks failed; scroll up to seezWheel checks failed)rrrrrÚopenÚ toml_loadÚgetrÚKeyErrorr r#r(Úwarning) Ú source_dirÚ pyprojectÚfZpyproject_dataZbuildsysr)ÚbackendÚ backend_pathrZsdist_okZwheel_okr!r!r"Úcheck‡s0          r4cCs`tjƒ}|jddd�|j|ƒ}tƒt|jƒ}|rDttddƒƒnttddƒƒt j dƒdS) Nr/z%A directory containing pyproject.toml)Úhelpz Checks passedÚgreenz Checks failedÚredr) ÚargparseÚArgumentParserÚ add_argumentÚ parse_argsr r4r/ÚprintÚansiÚsysÚexit)ÚargvZapÚargsÚokr!r!r"Úmain©s  rCzzzz)ÚresetZboldr7r6cCs8tjdkr,tjjƒr,t|t|ƒtdSt|ƒSdS)NÚntrD)ÚosÚnamer>ÚstdoutÚisattyÚ ansi_codesÚstr)ÚsÚattrr!r!r"r=Ãsr=Ú__main__)N)#Ú__doc__r8ÚloggingrFÚos.pathrrrZpip._vendor.tomlrrr+rÚ subprocessrr>rÚtempfilerr&Zcolorlogr Zenvbuildr Úwrappersr Ú getLoggerÚ__name__rr#r(r4rCrJr=r!r!r!r"Ús4      98"