bg~dZddlZddlZddlmZddlmZddlmZddl m Z m Z m Z ddl mZddlmZdd lmZdd lmZdd lmZmZmZmZmZmZdd lmZdd lmZm Z GddeZdS)zC Modified version of build_ext that handles fortran source files. N)glob) newer_group) build_ext)DistutilsFileErrorDistutilsSetupErrorDistutilsError) copy_file)log)filepath_from_subprocess_output) combine_paths)filter_sourcesget_ext_source_filesget_numpy_include_dirshas_cxx_sources has_f_sources is_sequence)show_fortran_compilers)new_ccompiler_opt CCompilerOptceZdZdZejgdzZejdddefgzZejddgzZdZ d Z d Z dd Z d Z d ZdZdZdZdZdS)rz:build C/C++/F extensions (compile/link to build directory)))z fcompiler=Nz!specify the Fortran compiler type)z parallel=jznumber of parallel jobs) warn-errorNz'turn all warnings into errors (-Werror))z cpu-baseline=Nz4specify a list of enabled baseline CPU optimizations)z cpu-dispatch=Nz.specify a list of dispatched CPU optimizations)disable-optimizationNz1disable CPU optimized code(dispatch,simd,fast...))z simd-test=NzMspecify a list of CPU optimizations to be tested against NumPy SIMD interfacezhelp-fcompilerNz list available Fortran compilersrrctj|d|_d|_d|_d|_d|_d|_d|_dSN) old_build_extinitialize_options fcompilerparallel warn_error cpu_baseline cpu_dispatchdisable_optimization simd_test)selfs t/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib64/python3.11/site-packages/numpy/distutils/command/build_ext.pyrzbuild_ext.initialize_options4sK(...   $(!c 2|jr= t|j|_n"#t$r}td|d}~wwxYwt|jt r)|jtj|_|jpg}|j j g|j _|j j|_|j |tj || ddddddd|jtjd <dS) Nz)--parallel/-j argument must be an integerbuild)rr)r r )r!r!)r"r")r#r#)r$r$r$)rint ValueError isinstance include_dirsstrsplitospathsep distributionextendrfinalize_optionsset_undefined_optionsr$rconf_target_groups)r%e incl_dirss r&r4zbuild_ext.finalize_options>s+ = U U #DM 2 2  U U U !LMMSTT U d' - - D $ 1 7 7 C CD %+   ) 1-/D  * -:   +++&t,,, ""7(@(D(H(H(X(B  $ $ $8<~ ' 444s# A=Ac jsdSdjrjrjjdr/tjdj d}nj d}d|_| | djjd<n*d d}j |jnd}ddlm}ddlm}j}||jjj_jjjjr>jjd jjd jjst<j d d d d }t<j dj!|}t<j"t<j j#d}tIdrj%&tOj|j(j)|_%d}ddl*}|+|j%t<j j#d_,t<j-j,st=j.j,i} |r|j/pgD]h\} } | | vrZ| | | krNtjd| dta| | dddta| ddd| | | <ijj/pgD]\} } | | vr | | | <tc} jD]N} tc}g}g}g}| j/D]} | | vrl| | }||dgz }||dgz }|dgD]}||vr||| | idgD]}|2||rG| j/|z}tj3d| j4d| j/d||| _/| j |z| _ |r.tj3d| j4d || j5|z| _5tm| j7r|2d!tq| j7r|2d"| j9pj:| j7}|r|2|d"|vrd"}nd#}d$}d%|vrd%}d&}nd!|vrd!}d&}| j9r|r2|r0||kr*| j9r#tjd'| j4d(|d|d)|| _9| ;|Pd%| v}d!| v}d"| v}|r||jjj_<j<}|j|*|||=_<nd_<|rj>}|j>jjjd$j+_?j?}|r!|j@}|j|r>|Ar*||n'd,|zd_?nd_?|rj>}|j>jjjd&j+_BjB}|r!|j@}|j|r>|Ar*||n'd-|zd_Bnd_BCfd.jD}|D]}t<j |d} js%t<j jD| } t=jEj,D]}!t<j-| st=j.| |!FGd/s]t<j j,|!}"t|"| dS)0N build_src build_clibzMbuild_clib already run, it is too late to ensure in-place build of build_clibr) new_compiler) new_fcompiler)compilerverbosedry_runforcez-Werrornumpy distutilsincludeznpy_cpu_dispatch_config.hzccompiler_opt_cache_ext.py compiler_opt)r?dispatch_hpathr!r" cache_pathc~tjdtj|ddS)Nz2 ########### EXT COMPILER OPTIMIZATION ###########T)full)r inforeport)copts r&rLzbuild_ext.run..reports7NOOO$//00000r'z.libszlibrary z0 defined more than once, overwriting build_info i,z ... with z... libraries library_dirsmacrossource_languageszupdating extension z libraries from  to zextending extension z defined_macros with f77c++cFf90Tzresetting extension z language from .)need_cxx)r?r@rArB requiref90 c_compilerz!f77_compiler=%s is not available.z!f90_compiler=%s is not available.cvh|]5}|jdd6S)rWr)get_ext_fullnamenamer/).0extr%s r& z build_ext.run..SsL     ! !#( + + 1 1# 6 6q 9   r'z.dll)I extensions run_commandr2has_c_librariesinplacehave_rungetr warnget_command_objensure_finalizedrunget_finalized_commandrOappendr;distutils.ccompilerr=numpy.distutils.fcompilerr>r?r@rArB customize customize_cmdr compiler_soshow_customizationr#r0pathjoinr:abspath build_temphasattrrF cache_flushrr!r"atexitregister extra_dll_dirisdirmakedirsrNreprsetaddrKr] define_macrosrsourcesrlanguagedetect_languageupdate _cxx_compiler cxx_compilerr _f77_compiler compiler_type get_version _f90_compilerbuild_extensions build_liblistdirlowerendswithr )#r%r;r=r>rrGopt_cache_pathrLryclibslibname build_info all_languagesr_ ext_languagesc_libs c_lib_dirsrPbinfoml new_c_libs ext_language has_fortranneed_f90_compilerneed_f77_compilerneed_cxx_compilerr?ctyper pkg_rootspkg_rootshared_lib_dirfn runtime_libs#` r&rjz build_ext.run`s   F %%%   , , . . | F$-11,?? AHCDDD!%!2!B!B$"&"&JJ"&!2!B!B$"&"&J)*J&//111NN$$$?@D%.|<<  ...!77 EE   $ $Z%: ; ; ; ;J 544444;;;;;; $ m-1\-1\+/:777   1222 ##D))) ? 8 M " ) )) 4 4 4 M % , ,Y 7 7 7 ((***( 7W\\'; KfggNW\\$*D*D[*Q*Q*[]kllNW__ T_.JKKNt^,, 0!--/// 1~!.T=N)!!!D   1 1 1 MMM OOFD$5 6 6 6 W\\$/7CCw}}T/00 , K* + + +  !'1';'Ar , ,#e##g*(D(DHH 'eGn)=)=dsd)C)C)CT*EUEUVZWZVZE[E[E[]^^^",g#'#4#>#D" ( ( GZ%'E'NN ?B 0B 0CEEMFJF= ) )e##!'NEeii R888F%))NB"?"??J"YYx44--F??"MM!,,,7B//334FKK))A!%%a(((() A ]V3 HHHcmmmZZABBB * #j#@  ?HHHff.///$'$5$>!S[)) )!!%(((s{++ )!!%((( J = =ck J JA %!!!$$$ %%$ " K %%$ " -''$ " < :; ::l**s|*HH!hhh<<<9:::(CL   / / / /!]2!]2!]2  &!-}6:l6:l48J"@"@"@D )H   t0;L  M M M  " "4 ( ( (  ' ' ) ) )!)!6!6!8!8D  !%D   &NE!.7;|7;|59Z:?:>- "I"I"ID  *I 7!/##D$5666 *Y2244 *''---,,.... = "###%)""!%D   &NE!.7;|7;|59Z:>:>- "I"I"ID  *I 7!/##D$5666 *Y2244 *''---,,.... = "###%)""!%D         " 7 7HW\\(G<12|j}|t|std|jzt |}|sdS||j}|jr|d}d|dd}|d}| d}| |}tj || |} n8tj |j| |} ||jz} |j} |js/|jst)jdd} | s-t-| | dst)jd |jdSt)jd |j|jpg} t3|d dpg} t3|d dpg}|jdd}|jD]}||ft;|j\}}}}|jjd kr#|r| d| |z } ||z }g}|j dkr|j!}n!|j dkr|j"}n|j!p|j"}|@tG|dr |j$pgng|_$tG|dr |j%pgng|_%|j&}|r|tOd|jz|s|r|tOd|jz|j dvr||(d|jz|j dkr||(d|jzd|ji}|j)}|j*tWz}g}g}g}g}|js| dj,}tj ddd}tj ||}|||jrdn|} |f|df||f|dffD]%\}!}"1|!D]2|"12fd 2ddDz }"&|j-}n|d!g}#|r=t)jd"|#|jj.|f|| ||z||j| |z|d#|z }#|rt)jd&|#|jj/|f|||z||j| |z| zd'|z }#|r9t)jd(|#|j/|f|||z||j| |z|zd'|z }#g}$g}%|rt)jd)|j0dd}&tj |j)tj 1| |}'|2|'|j3tid*}(|$|5|&|'z }$|%|/||j)|||j|$|j+z }%|j3tid*D]})|)|(vrtj |'|)}*tj 6|)tj 6|*krhtj 7|*rtj8|* |9|)|'#tt$rt)j(d,|)d-|'YwxYw|rBt)jd.|%|/||j)|||j|$|j+z }%|%r|;|js|%}+|#},ng}+|#|%z},|j<r|,=|j<|j>pg} |?|dd}-|j@dd}.|jjA}/|jjd/vrZ|B||-|.|jCr;|jCD],}0ti|0d0zD]})t|)|jE-g|_Cn|j dvr ||jA}/|j dkr ||jA}/||F|,|-||.|+\},}-|/|,| |-|.|jC| |G||j|j)|j 1 dS)2Nzjin 'ext_modules' option (extension '%s'), 'sources' must be present and must be a list of source filenamesrWrbuild_pyz*Detected changes on compiler optimizationsTnewerz$skipping '%s' extension (up-to-date)zbuilding '%s' extensionextra_c_compile_argsextra_cxx_compile_argsmsvcz/Zm1000rVrSextra_f77_compile_argsextra_f90_compile_argsz5extension %r has C++ sourcesbut no C++ compiler foundz>extension %r has Fortran sources but no Fortran compiler found)rSrVzTextension %r has Fortran libraries but no Fortran linker found, using default linkerrTzLextension %r has C++ libraries but no C++ linker found, using default linkerdependsr:rCrDrE)z .dispatch.c)z .dispatch.cppz .dispatch.cxxcg|]?}||@Sr)rpopindex)r^s_ext_srcs r& z-build_ext.build_extension..sPAJJt,<,<A//r')NPY_DISABLE_OPTIMIZATIONr<z#compiling C++ dispatch-able sources) output_dirsrc_dirrPr-debugextra_postargs ccompilerz!compiling C dispatch-able sources)rrrPr-rrzcompiling C sources)rrPr-rrzcompiling C++ sourcesz#compiling Fortran 90 module sourcesz*.mod)rrPr-rrrzfailed to move rRzcompiling Fortran sources)rintelwintelemwz/*.dll)rNrOruntime_library_dirsrexport_symbolsrrv target_lang)Hrrrr]listr\rdr/rtrkget_package_dirr0rsget_ext_filenamerrrBr#rF is_cachedr rrrKextra_compile_argsgetattrr undef_macrosrlr r?rrrrrwrrrrrgrvr-rr:cpu_baseline_flags try_dispatchcompile module_dirsdirnamemkpathmodule_dir_switchrmodule_optionsruisfileremove move_filercan_ccompiler_link extra_objectsr3extra_link_args get_librariesrOlink_shared_object_libs_with_msvc_and_fortranrr r{_process_unlinkable_fobjectsget_export_symbols)3r%r_rfullnamemodpathpackagebaser package_dir ext_filenamer force_rebuild extra_args extra_cflagsextra_cxxflagsrPundef c_sources cxx_sources f_sourcesfmodule_sourcesrrkwsrr-copt_c_sourcescopt_cxx_sourcescopt_baseline_flags copt_macrosbsrc_dirrGcopt_build_src_srcs_dst c_objectsr f_objectsrmodule_build_direxisting_modulesftunlinkable_fobjectsobjectsrNrOlinkerdrrs3 @@r&build_extensionzbuild_ext.build_extensiongs + ?+g"6"6?%.14:;; ;w--  F((22 < InnS))Ghhwqt}--G2;D11*==H"227;;K7<< (,(=(=d(C(CEELL7<<(,(=(=h(G(GIILCK' ( !1B1L1L1N1N ! IB C C C M :WlG!L!L : IEEK"111%% $ $E MM5( # # # # 3; ' ' ; ; ? = && 0 0 /!!),,,.   $IK <5 *II \U " "*II*@d.@I  U\-V/V/070J0Pb46  ,U\-V/V/070J0Pb46  ,)   K</ "=@C"JKK K  O Oi.? "ADGH"NOO O <> ) )i.? IIJMPXW X X X <5 \%9 IIFILS T T T#+&_ '*@*B*BB   ( @11+>>HHW\\'; JJNW\\(NCCN    / / /%)\?TTxN~/?@[)+;68&  !tT "D!%aaaDD #'"3"F"F"H"H     > ? ? ?   H: ; ; ; 7*7  %& +)j)N:&     I   H8 9 9 9 7*7%& +)j)L8 I   H* + + + ..% +)j *-@ @ ,!-  I   H, - - - --% +)j *-@ @ .!/  I ! 8 H: ; ; ;/!!!,K!w||))(33"5"5 6 6  KK( ) ) )*2#'== i66-// /N **?6:o288D15:H36; +@@ @I*2g 8 8A,,,  %5q99Awq))RW__Q-?-??? w~~a((% ! 8q*:;;;;-888"#!!%5%5"7888888  @ H0 1 1 1 **96:o288D15:H36; +@@ @I  ,Y99$-HH ,"+ GG"$ )+G   . NN3, - - -(.B &&s++AAA. '* 1 = &*H H H  , ,9l 4 4 4' .199A!!h,//99!!T%788889+-( \^ + + 0E1F <5 \%=!4F  !%!B!BY|'")") GY w "($'$<("55c::Z/< ) ) ) ) ) )s&\==$]$#]$c4|dj}|dj}|jt j|dg|j}|j |d||j dS)Nr:r;zgfortran_vs2003_hack.c)r_gfortran_workaround)rr) rkr:r;r?rr0rsrtrvcreate_static_libr)r%rr:r;rs r&_add_dummy_mingwex_symz build_ext._add_dummy_mingwex_symks..{;;E // ==H -''i6N*P*P)Q37?(DD '' + $* ( V V V V Vr'ct|}t|}t|}|ddD]D}|D]=}tj||dz}tj|r||t |5} ||  dddn #1swxYwYtj||dz} t | 5} ||  dddn #1swxYwY?F|rCd|D} | | |j |j } || ||fS)Nz .fobjectsz .cobjectscLg|]!}tj|"Sr)r0rsru)r^objs r&rz:build_ext._process_unlinkable_fobjects..s&LLL,,LLLr')rr{) rr0rsrtrropenr3read splitlineswrap_unlinkable_objectsrvr{) r%rrNrrOrliblibdirfake_librc_libfobjectswrappeds r&rz&build_ext._process_unlinkable_fobjectsts5OO w--"#677 QQQ< > >C& > >7<<k0ABB7>>(++ >$$S)))hJ1+22166883F3F3H3HIIIJJJJJJJJJJJJJJJGLL{1BCCEe>qvvxx':':'<'<===>>>>>>>>>>>>>>> >  $LL8KLLLH77"&"4866G NN7 # # # !!s$&:C,,C0 3C0 ):E//E3 6E3 c.|dS|D]1}|drd}|pgD]H}tj|d|z}tj|rd}nI|rkd}|D]}tj|d|z}tj|r_tj|j|dz}t |||j|vr||jd}n|rtj d|d|3g} |j D]p} | d rD tj d d | g} t| } n#ttjf$rYnwxYw| | q|| |jD]} | ds|| t%| d | zd z} | rtj|j| dz} tj| st | d| |j|vr||jdS)NrFz%s.libTzlib%s.az.libzcould not find library z in directories z/usr/libcygpathz-wrz.ar) startswithr0rsrtrrvr rlr rgrO subprocess check_outputr OSErrorCalledProcessErrorr3rNr )r%r c_librariesc_library_dirsr fileexistsrlibfilelibfile2 f_lib_dirsdirrpdst_names r&rz%build_ext._libs_with_msvc_and_fortrans   F" 2 2G!!&)) J(.B  ',,vx7/CDD7>>'**!%JE J(  ',,vyG/DEE7>>'** "w||DOWv=MNNHgx000n<<&--do>>>!%JE  HH1 2 2 2 2 ) # #C~~j)) ??$19dC2HIIC:#>>CC !>?D   c " " " "j)))& ? ?C>>&)) ?""3'''!*eckD.@AA?!w||DOS6\JJH7>>(332!!A$111n<<&--do>>> ? ?sFFFc||jg}|jD]$}|t|%|Sr)check_extensions_listrar3r)r% filenamesr_s r&get_source_fileszbuild_ext.get_source_filessT ""4?333 ? 8 8C   1#66 7 7 7 7r'c ,||jg}|jD]o}|js ||j}|t j|j | |p|Sr) r&rarr\r]rlr0rsrtrr)r%outputsr_rs r& get_outputszbuild_ext.get_outputss ""4?333? J JC; ,,SX66H NN27<<(,(=(=h(G(GII J J J Jr'r)__name__ __module__ __qualname__ descriptionr user_options help_optionsrboolean_optionsrr4rjrrrrrr(r+rr'r&rrsNK -111L"!- 4!C  !1L $3|E[6\\O F F FDA7A7A7FB)B)B)HVVV!"!"!"F;?;?;?z     r'r)!__doc__r0rrdistutils.dep_utilrdistutils.command.build_extrrdistutils.errorsrrrdistutils.file_utilr numpy.distutilsr numpy.distutils.exec_commandr numpy.distutils.system_infor numpy.distutils.misc_utilr rrrrr'numpy.distutils.command.config_compilerrnumpy.distutils.ccompiler_optrrrr'r&r>s ******BBBBBB))))))HHHHHH555555KJJJJJIIIIIIIIM M M M M M M M M M r'