a ˆljÄã@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ÚerrorZget_requires_for_build_sdistÚ ExceptionrZ build_sdistÚshutilÚrmtreeÚendswithÚpjoinrÚtarfileZ is_tarfile©ÚhooksZbuild_sys_requiresÚenvZreqsZtdÚfilenameÚpath©r%úÚstdoutÚisattyÚ ansi_codesÚstr)ÚsÚattrr%r%r&r=Çsr=Ú__main__)N)#Ú__doc__r8r-ZloggingrFZos.pathrrrrÚ subprocessrr>rZtempfilerr(ZcolorlogrÚcompatrr Zenvbuildr Zwrappersr Z getLoggerÚ__name__rr'r*r4rCrJr=r%r%r%r&Ús8      98" ü