o ƚRe@sdZddlZddlZddlZddlZddlmZmZddl Z ddl m Z ddl Z ddl Z ddlmZddlZddlmZddlmZmZdd lmZdd lmZeeZd d Zd dZddZdddZ dddddZ!ddZ"edkrze dSdS)zHCheck a project and backend by attempting to build using PEP 517 hooks. N)isfilejoin)CalledProcessError)mkdtemp)enable_colourful_output)TOMLDecodeError toml_load)BuildEnvironment)Pep517HookCallerc C@t}z ||tdWnty&tdYWddSwz |i}td|WntyKtjdddYWddSwz ||tdWntymtd YWddSwt}td |zz| |i}td |Wntytjd ddYWt |WddSw| d std|Wt |WddSt ||}t|rtd|ntd|Wt |WddSt|rtdntdWt |WddSWt |nt |w WddS1swYdS)N#Installed static build dependencies+Failed to install static build dependenciesFGot build requires: %s'Failure in get_requires_for_build_sdistTexc_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 extensionOutput file %s existsOutput file %s does not existzOutput file is a tar filezOutput file is not a tar file)r pip_installloginforerrorget_requires_for_build_sdist Exceptionr build_sdistshutilrmtreeendswithpjoinrtarfile is_tarfilehooksZbuild_sys_requiresenvreqstdfilenamepathr+/builddir/build/BUILDROOT/alt-python310-pip-21.3.1-3.el8.x86_64/opt/alt/python310/lib/python3.10/site-packages/pip/_vendor/pep517/check.pycheck_build_sdistsz                 %   ,   -&r-c Cr )Nr rFrrTrrrzTrying 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 rrrrrget_requires_for_build_wheelrr build_wheelrrr r!rzipfile is_zipfiler$r+r+r,check_build_wheelPsv                  $   +   ,&r2c Cst|d}t|rtdntddSz2t|d }t|}Wdn1s,wY|d}|d}|d}|d }td Wnt t fy[tjd d d YdSwt |||}t ||} t ||} | sstd| sztd| S)Nzpyproject.tomlzFound pyproject.tomlzMissing pyproject.tomlFrbz build-systemrequiresz build-backendz backend-pathzLoaded pyproject.tomlzInvalid pyproject.tomlTrz%Sdist checks failed; scroll up to seezWheel checks failed)r!rrrrioopenr getrKeyErrorr r-r2warning) source_dir pyprojectfZpyproject_dataZbuildsysr4backend backend_pathr%Zsdist_okZwheel_okr+r+r,checks4          r?cCsltdt}|jddd||}tt|j}|r(t t dddSt t ddt d dS) NzQpep517.check is deprecated. Consider switching to https://pypi.org/project/build/r:z%A directory containing pyproject.toml)helpz Checks passedgreenz Checks failedredr) rr9argparseArgumentParser add_argument parse_argsrr?r:printansisysexit)argvZapargsokr+r+r,mains   rNzzzz)resetboldrBrAcCs4tjdkrtjrt|t|tdSt|S)NntrO)osnamerIstdoutisatty ansi_codesstr)sattrr+r+r,rHsrH__main__)N)#__doc__rCr5loggingrRos.pathrrr!r subprocessrrIr"tempfilerr0Zcolorlogrcompatrr Zenvbuildr wrappersr getLogger__name__rr-r2r?rNrVrHr+r+r+r,s<      98 "