
    h$,f                     V    d Z ddlZddlZddlZddlZddlZddlZddlmZm	Z	 ddZ
d Zy)zFHelpers to check build environment before actual build of scikit-learn    N)customize_compilernew_compilerc                    t               }t        |       t        j                  j	                  d      }t        j                         5 }	 t        j                  |       t        dd      5 }|j                  |        ddd       t        j                  d       |j                  dgd|       t        j                  t        j                  j                  dd|j                  z               }|j                  |d||	       d
t        j                   vrQt#        j$                  d      }|j'                  t(        j*                  j,                  xs d      j/                         }ng }t        j                  |       	 ddd       |S # 1 sw Y   xY w# t0        $ r  w xY w# t        j                  |       w xY w# 1 sw Y   S xY w)z.Check that some C code can be compiled and run.ztest_program.cwNobjects)
output_dirextra_postargs*test_program)extra_preargsr
   PYTHON_CROSSENVz./test_programzutf-8)r   r   ospathabspathtempfileTemporaryDirectorychdiropenwritemkdircompileglobjoinobj_extensionlink_executableenviron
subprocesscheck_outputdecodesysstdoutencoding
splitlines	Exception)	coder   r
   	ccompiler	start_dirtmp_dirfr   outputs	            Flib/python3.12/site-packages/sklearn/_build_utils/pre_build_helpers.pycompile_test_programr-      s   Iy!$I		$	$	& $ '#	 HHW &,  HHY !"y  
 iiYi>U>U8U VWG%%+-	 &  !

2 $001ABszz':':'EgFQQS  HHYI$ L MC 8  		 HHYI$ L MsI   	F?!F,F
>C,F*F?
F	FF""F%%F<<F??G	c                  j    dt         j                  v ryt        j                  d      } t	        |        y)z-Check basic compilation and linking of C codePYODIDE_PACKAGE_ABINzX        #include <stdio.h>
        int main(void) {
        return 0;
        }
        )r   r   textwrapdedentr-   )r&   s    r,   basic_check_buildr2   =   s.    

*??  D     )NN)__doc__r   r   r   r!   r   r0   setuptools.command.build_extr   r   r-   r2    r3   r,   <module>r7      s(    L  	  
   I-`r3   