id*rddlZddlZddlZddlmZmZddlmZmZddl m Z ddl m Z m Z mZddlmZmZddlmZmZmZddlmZdd lmZmZdd lmZdd Zd at6adZdZeZGddeZ Gdde Z!Gdde Z"Gdde Z#GddZ$dZ%dS)N)mkstempmkdtemp)PopenPIPE)DistutilsError)assert_ assert_equal assert_raises) ccompilercustomized_ccompiler) system_info ConfigParsermkl_info)AliasedOptionError)default_lib_dirsdefault_include_dirs) _shell_utilsctttd|t }|S)zg notfound_action: 0 - do nothing 1 - display warning message 2 - raise error )temp1temp2duplicate_options) Temp1Info Temp2InfoDuplicateOptionInfogetlower _system_info)namenotfound_actioncls [/opt/cloudlinux/venv/lib/python3.11/site-packages/numpy/distutils/tests/test_system_info.py get_classr#sB2   C l + + 244Ka [ALL] library_dirs = {dir1:s}{pathsep:s}{dir2:s} libraries = {lib1:s},{lib2:s} extra_compile_args = -I/fake/directory -I"/path with/spaces" -Os runtime_library_dirs = {dir1:s} [temp1] library_dirs = {dir1:s} libraries = {lib1:s} runtime_library_dirs = {dir1:s} [temp2] library_dirs = {dir2:s} libraries = {lib2:s} extra_link_args = -Wl,-rpath={lib2_escaped:s} rpath = {dir2:s} [duplicate_options] mylib_libs = {lib1:s} libraries = {lib2:s} z /* This file is generated from numpy/distutils/testing/test_system_info.py */ #include void foo(void) { printf("Hello foo"); } void bar(void) { printf("Hello bar"); } ct} |j}nN#t$rA |js|n#t t f$rYYdSwxYw|jg}YnwxYw t|tt}|j |j | n#t$rYdSwxYwdS)z? Return True if there appears to be an executable compiler F)stdoutstderrT)r compilerAttributeError initialized initializer ValueErrorccrrr&closer'waitOSError)r(cmdps r" have_compilerr3@s$%%H  ' &##%%% +   555 {m  #d4 0 0 0    uu 4sB A#?A#AA#A A#"A#'A"C CCc"eZdZeedfdZdZdS)rrc ji|j_g|_ddddddddd}t||_dS)N0) library_dirs include_dirsruntime_library_dirsrpathsrc_dirssearch_static_firstextra_compile_argsextra_link_args) __class__infolocal_prefixesrcp)selfrr verbositydefaultss r"__init__z_system_info.__init__\sO ! $&$&,. "+.*,')++x((r$c||d}|S)z-Override _check_libs to return with all dirs ) librariesr8)rDlib_dirslibsopt_libsextsrAs r" _check_libsz_system_info._check_libsos!8<< r$N)__name__ __module__ __qualname__rrrGrOrJr$r"rrZsB#3&:))))&r$rceZdZdZdZdS)rFor testing purposesrNrPrQrR__doc__sectionrJr$r"rruGGGr$rceZdZdZdZdS)rrTrNrUrJr$r"rrzrXr$rceZdZdZdZdS)rrTrNrUrJr$r"rr~s!GGGr$rceZdZdZdZdZdZdZdZe j e dd Z e j e de j d eejvd d Zd edgvZe j eddZdS)TestSystemInfoReadingc pt|_tj|jd|_tj|jd|_t|_tj|jd|_tj|jd|_ tj d i|j|j|j|j tj tj|j gdat!\}|_tj|t'|jd5}|tdddn #1swxYwYt'|jd5}|t*dddn #1swxYwYt'|jd5}|t*dddn #1swxYwYd}|t-d |j|_|t-d |j|_|t-d |j|_|t-d |j|_dS)z Create the libraries zfoo.cz libfoo.sozbar.cz libbar.so)dir1lib1dir2lib2pathsep lib2_escapedwNc>|g|_||SN)filesparse_config_files)csite_cfgs r"site_and_parsez:TestSystemInfoReading.setup_method..site_and_parses"jAG " " "Hr$defaultrrrrJ)r_dir1ospathjoin_src1_lib1_dir2_src2_lib2 simple_siteformatrbr NativeParserrjr_sitecfgr.openwritefakelib_c_textr# c_defaultc_temp1c_temp2 c_dup_options)rDfdrks r" setup_methodz"TestSystemInfoReading.setup_methodsYY W\\$*g66 W\\$*k:: YY W\\$*g66 W\\$*k:: %  JJJJz(5::DJ<HH ) )   $IIDM  $- % %  HHX                  $*c " " %b HH^ $ $ $ % % % % % % % % % % % % % % % $*c " " %b HH^ $ $ $ % % % % % % % % % % % % % % %   ( )(<()z-I/fake/directoryz-I/path with/spacesz-Os) r}r get_lib_dirsrmrs get_librariesrrruget_runtime_lib_dirscalc_extra_inforDtsiextras r"test_allzTestSystemInfoReading.test_allsnS%%''$*dj)ABBBS&&((4:tz*BCCCS--//$*>>>##%%U/02e2e2efffffr$c|j}t||jgt||jgt||jgdSrf)r~r rrmrrrrrDrs r" test_temp1z TestSystemInfoReading.test_temp1solS%%''$*666S&&((4:,777S--//$*>>>>>r$cn|j}t||jgt||jgt|d|jg|}t|dd|jzgdS)Nr;)keyr?z -Wl,-rpath=)rr rrsrrurrrs r" test_temp2z TestSystemInfoReading.test_temp2slS%%''$*666S&&((4:,777S--'-::TZLIII##%%U,-  0J/KLLLLLr$c |j}tt|jddt |d|jg|jgt |d|jg|jgdS)N mylib_libsrI)rr rget_option_singler get_libsrrrurs r"test_duplicate_optionsz,TestSystemInfoReading.test_duplicate_optionsst (#*?{[[[S\\, == |LLLS\\+ |<chhjj(('1== > > > > > > > > > > > > > > >c3 3 #               ::D$$&&(2222c Ccxxzz))';BB C C C C C C C C C C C C C C Cc3 3 $               ::D$$&&(22222 H[ ! ! ! ! !BH[ ! ! ! !sBI*D > I DIDI%E; IE  IE :I *F?3 I?GIGIG<0 I<HIH+IIN)rPrQrRrrrrrrpytestmarkskipif HAVE_COMPILERrreprr new_compilerrrcalc_libraries_inforHAS_MKLxfailrrJr$r"r\r\s';';';R   ggg???MMMLLL [M)2DEE " "FE " [M)2DEE [$$'=y'='?'?"@"@@ ;==""==FE" ((**88::>>{BOOOG [w)JLL""LL"""r$r\cddlm}d}td}||d|||\}}t |dksJ|tdksJt |dksJ||d |||\}}t |dksJt |dksJd D]i}|||d |||\}}t |d ksJ|td ksJt |dksJjt jt5||d|||dddn #1swxYwYt jt5||d|||ddddS#1swxYwYdS)Nr)_parse_env_order#NPY_TESTS_DISTUTILS_PARSE_ENV_ORDERabcdefzb,i,e,fbefrr6z^!zb,i,eacdfzb,^e,iz!b,^e,i)numpy.distutils.system_inforlistsetenvlenrraisesr,) monkeypatchrenv base_orderorderunknownprefixs r"test_distutils_parse_env_orderr$s<<<<<< /ChJsI&&&%%j#66NE7 u::???? DKK     w<<1    sB%%j#66NE7 u::???? w<<1    !!36 0 0 0111))*c::w5zzQV $$$$7||q     z " "**3)))S)))*************** z " "**3 ***S)))******************s$#E??FF##GGG)r)&rnrrtempfilerr subprocessrrdistutils.errorsr numpy.testingrr r numpy.distutilsr r rr rrrrrrr#rvrjr|r3rrrrrr\rrJr$r"rs) %%%%%%%%""""""""++++++>>>>>>>>>>;;;;;;;;KKKKKKKKKK::::::NNNNNNNN((((((     ,  .  ;6   """"",""" ^"^"^"^"^"^"^"^"B*****r$