a €™ReÄã@sôdZddlZddlZddlZddlZddlmZmZddl Z ddl m Z ddl Z ddl Z ddlmZddlZddlmZddlmZmZdd lmZdd lmZe e¡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)ÚCalledProcessError)Úmkdtempé)Úenable_colourful_output)ÚTOMLDecodeErrorÚ toml_load)ÚBuildEnvironment)ÚPep517HookCallerc CsHtƒ*}z| |¡t d¡Wn*tyLt d¡YWdƒdS0z| i¡}t d|¡Wn.ty–tjdddYWdƒdS0z| |¡t d¡Wn*tyÚt d ¡YWdƒdS0tƒ}t d |¡z$z|  |i¡}t d |¡Wn<tyJtjd ddYWt   |¡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ƒdS1s: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ÚerrorÚget_requires_for_build_sdistÚ ExceptionrÚ build_sdistÚshutilÚrmtreeÚendswithÚpjoinrÚtarfileÚ is_tarfile©ÚhooksZbuild_sys_requiresÚenvÚreqsÚtdÚfilenameÚpath©r*ú‡/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/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–tjdddYWdƒdS0z| |¡t d¡Wn*tyÚt d ¡YWdƒdS0tƒ}t d |¡z$z|  |i¡}t d |¡Wn<tyJtjd ddYWt   |¡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ƒdS1s: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 rrrrrÚget_requires_for_build_wheelrrÚ build_wheelrrrr rÚzipfileÚ is_zipfiler#r*r*r+Úcheck_build_wheelPsd            ì   ð    ÷    ýr1c Csøt|dƒ}t|ƒrt d¡nt d¡dSzdt |d¡}t|ƒ}Wdƒn1sX0Y|d}|d}|d}| d ¡}t d ¡Wn&t t fy¶tjd d 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)r rrrrÚioÚopenr ÚgetrÚKeyErrorr r,r1Úwarning) Ú source_dirÚ pyprojectÚfZpyproject_dataZbuildsysr3ÚbackendÚ backend_pathr$Zsdist_okZwheel_okr*r*r+Úcheckˆs0   &      r>cCsjt 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/r9z%A directory containing pyproject.toml)Úhelpz Checks passedÚgreenz Checks failedÚredr) rr8ÚargparseÚArgumentParserÚ add_argumentÚ parse_argsrr>r9ÚprintÚansiÚsysÚexit)ÚargvZapÚargsÚokr*r*r+Úmainªs þ  rMzzzz)ÚresetÚboldrAr@cCs8tjdkr,tj ¡r,t|t|ƒtdSt|ƒSdS)NÚntrN)ÚosÚnamerHÚstdoutÚisattyÚ ansi_codesÚstr)ÚsÚattrr*r*r+rGÇsrGÚ__main__)N)#Ú__doc__rBr4ÚloggingrQÚos.pathrrr rÚ subprocessrrHr!Útempfilerr/ZcolorlogrÚcompatrr Zenvbuildr Úwrappersr Ú getLoggerÚ__name__rr,r1r>rMrUrGr*r*r*r+Ús8      98" ü