RedZddlZddlZddlZddlZddlmZddlZddlm Z ddl m Z ddl m Z ddlmZmZejeZd ZGd d eZdd Zdd ZdS)zIBuild wheels/sdists by installing build deps to a temporary environment. N) check_call) get_paths)mkdtemp) toml_load)Pep517HookCaller LoggerWrapperctjtj|dd5}t |}dddn #1swxYwY|d}|d|d|dfS)Nzpyproject.tomlrbz build-systemrequiresz build-backendz backend-path)ioopenospathjoinrget) source_dirfpyproject_databuildsyss /builddir/build/BUILDROOT/alt-python311-pip-21.3.1-3.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_vendor/pep517/envbuild.py_load_pyprojectrs  GLL%5 6 6   &"1 &&&&&&&&&&&&&&& n-H! ^$$ sAAAc0eZdZdZdZddZdZdZdZdS) BuildEnvironmentzContext manager to install build deps in a simple temporary environment Based on code I wrote for pip, which is MIT licensed. NTc||_dSN)_cleanup)selfcleanups r__init__zBuildEnvironment.__init__=s  c td|_td|jtjdd|_tjdd|_tj dkrdnd}t||j|jd }|d }|jr%|tj z|jztjd<n)|tj ztj ztjd<|d |d kr |d }n|d tj z|d z}|jr%|tj z|jztjd<n|tjd<|S) Nzpep517-build-env-)prefixzTemporary build environment: %sPATH PYTHONPATHnt posix_prefix)baseplatbase)varsscriptspurelibplatlib) rrloginforenvironr save_pathsave_pythonpathnamerpathsepdefpath)rinstall_scheme install_dirsr+lib_dirss r __enter__zBuildEnvironment.__enter__@sd#6777  2DI>>>55!z~~lDAA"$'T// I 7 7    y) > C!(2:!5!FBJv  !(2:!5 !BBJv   "l9&= = =#I.HH#I.;Y'(H   0'/"*'<$(%BJ| $ $(0BJ| $ r!c,|sdStd|tjddddd|jgt |z}t |tttj tttj dS) zAInstall dependencies into this env by calling pip in a subprocessNzCalling pip to install %sz-mpipinstallz--ignore-installedz--prefix)stdoutstderr) r.r/sys executablerlistrr loggingINFOERROR)rreqscmds r pip_installzBuildEnvironment.pip_install`s  F ,d333 ND%4H  #%)$ZZ0   gl33 gm44      r!c|jo,|jduo#tj|j}|rt j|j|j!tjddn|jtjd<|j "tjdddS|j tjd<dS)Nr$r%) rrrisdirshutilrmtreer1r0popr2)rexc_typeexc_valexc_tb needs_cleanups r__exit__zBuildEnvironment.__exit__ns M % IT ! % GMM$) $ $   % M$) $ $ $ > ! JNN64 ( ( ( (!%BJv    ' JNN< . . . . .'+';BJ| $ $ $r!)T) __name__ __module__ __qualname____doc__rr r9rGrQr!rrr!sg2 D    @    <<<<rms$  !!!!!! 55555555g!!   ^<^<^<^<^