idNKNdZddlZddlmZddlZddlmZddlmZm Z m Z ddl m Z ddl mZddlmZmZmZmZmZmZdd lmZejZeeeD]8Zeedd vr&eedd zfeed dzee<9Gd deZdS)zC Modified version of build_clib that handles fortran source files. N)glob) build_clib)DistutilsSetupErrorDistutilsErrorDistutilsFileError)log) newer_group)filter_sourcesget_lib_source_filesget_numpy_include_dirshas_cxx_sources has_f_sources is_sequence)new_ccompiler_opt)z build-clibz build-temp=cxeZdZdZejgdzZejgdzZdZdZdZ dZ dZ d Z d Z d Zd Zd S)rz1build C/C++/F libraries used by Python extensions))z fcompiler=Nz!specify the Fortran compiler type)inplaceizBuild in-place)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...))rrrctj|d|_d|_d|_d|_d|_d|_d|_dS)Nr) old_build_clibinitialize_options fcompilerrparallel warn_error cpu_baseline cpu_dispatchdisable_optimization)selfs W/opt/cloudlinux/venv/lib/python3.11/site-packages/numpy/distutils/command/build_clib.pyrzbuild_clib.initialize_options1sM)$///    $(!!!c|jr= t|j|_n"#t$r}td|d}~wwxYwtj||dddddddS)Nz)--parallel/-j argument must be an integerbuild)rr)rr)rr)r r )r!r!)rint ValueErrorrfinalize_optionsset_undefined_options)r"es r#r)zbuild_clib.finalize_options<s = U U #DM 2 2  U U U !LMMSTT U'--- ""7(@(D(H(H(X  $ $ $ $ $s# A=Acl|jD]+\}}t|dgrdS,dSNsourcesTF) librariesrgetr"lib_name build_infos r#have_f_sourceszbuild_clib.have_f_sourcesKsG&*n   "XzZ^^Ir::;; tt ur$cl|jD]+\}}t|dgrdS,dSr-)r/r r0r1s r#have_cxx_sourceszbuild_clib.have_cxx_sourcesQsG&*n   "Xzz~~i<<== tt ur$c|jsdSg}|d|jD]6\}}|dd}|r||vr||7ddlm}||j|j|j|_|j |j | |j r>|jjd|jj d|j}d|_|j|||_|j|jst"jdd d d }t"j|dj|}t"jt"j|jd }t1|d r|jt7|j||j|j||_d} ddl} | | |j| rddl!m"} | |j#|j$|j|jd|v|j|_%|j%g|j% |j |j}d|_|j%|||_|j%nd|_%|&|j|j'r|j j(D]}|j)|j*} t"j|j+| } t"j|j,| }|-|j,t]j/| |dSdS)N build_srclanguager) new_compiler)compilerdry_runforce)need_cxxz-Werrornumpy distutilsincludeznpy_cpu_dispatch_config.hzccompiler_opt_cache_clib.py compiler_opt)r;dispatch_hpathrr cache_pathc~tjdtj|ddS)Nz3 ########### CLIB COMPILER OPTIMIZATION ###########T)full)rinforeport)copts r#rHzbuild_clib.run..reports7OPPP$//00000r$ new_fcompilerf90r;verboser<r= requiref90 c_compiler)0r/ run_commandr0appenddistutils.ccompilerr:r;r<r= customize distributionr6r compiler_so customize_cmdshow_customizationr!ospathjoinget_finalized_commandr8abspath build_temphasattrrB cache_flushrrr atexitregisterr4numpy.distutils.fcompilerrKrrN _f_compilerbuild_librariesrinstalled_librarieslibrary_filenamenamer target_dirmkpathshutilcopy)r" languagesr2r3lr:r/rCopt_cache_pathrHrarKlibnamesourcetargets r#runzbuild_clib.runWs~  F  %%%&*n $ $ "Xzz400A $Qi''  ###444444$ dm-1\+/:777   1)-)>)>)@)@  B B B ? 8 M " ) )) 4 4 4 M % , ,Y 7 7 7N  ##D)))" ((***( 7W\\'; KfggNW\\$*D*D[*Q*Q*[]kllNW__ T_.KLLNt^,, 0!--/// 1~!.T=N)!!!D   1 1 1 MMM OOFD$5 6 6 6     $ ? ? ? ? ? ?,}dn59\59\37:8=8J8<  G G GD  + **4+<=== N !% ..t444!* 33555#D  T^,,, < ,&: , ,-88@@dow??alG<< AL))) FF++++  , , , ,r$c||jg}|jD]$}|t|%|SN)check_library_listr/extendr )r" filenameslibs r#get_source_fileszbuild_clib.get_source_filessT /// > 8 8C   1#66 7 7 7 7r$cD|D]\}}||||dSru)build_a_library)r"r/r2r3s r#rezbuild_clib.build_librariess?&/ B B "Xz  Xy A A A A B Br$c|gSg}|D]5}t|r|||z } ||6|S)ah Assemble flags from flag list Parameters ---------- in_flags : None or sequence None corresponds to empty list. Sequence elements can be strings or callables that return lists of strings. Callable takes `self` as single parameter. Returns ------- out_flags : list )callablerR)r"in_flags out_flagsin_flags r#assemble_flagszbuild_clib.assemble_flagssd  I  * *G   *WWT]]*   ))))r$c 01|j}|j}|d}|t|st d|zt |}t |\}}} } | p|dddk} g} |r| d|r| d| r| dn| r| d| |d<|||j } ||d gz}|j }|j s/|j stjd d }|s(t!|| d stjd|dStjd||di}||rtjd|ddlm}||j|j|j|j | |j}|X|j}|d}||||| s| r|t9d|z|8|dpg|_|dpg|_|d}|g}|d}|g}||d}||d}||d}| tC|dpg}tDj#$| }| r|%||jdkr ||z }g}||z }g}g}g}g}|j s|&dj'}tDj#(d d!d"} tDj#(|| } || |j)rdn|}!|f|d#f||f|d$ffD]%\}"}#0|"D]1|#01fd%1ddDz }#&|j *}n|d&g}$|rItjd'|$|j +||j,|!||z||j||z|%(z }$|rHtjd)|$|j +||j,|!||z||j||z*z }$|rEtjd+|$|-||j,||z||j||z|z,z }$|rktjd-|.}%|%-||j,||z||j||z|z,}&|$ |&| s| rg}g}'| r/|j/tad.}(||1||z }| rz.build_clib.build_a_library..KsPAJJt,<,<A//r$)NPY_DISABLE_OPTIMIZATIONrz#compiling C++ dispatch-able sources)rsrc_dirrrdebugextra_postargs ccompilerz!compiling C dispatch-able sources)rrrrrrzcompiling C sources)rrrrrzcompiling C++ sourcesz*.modz#compiling Fortran 90 module sourceszfailed to move z to zcompiling Fortran sourcesz .fobjectsw c3TK|]#}tj|V$dSrurYrZr]robjs r# z-build_clib.build_a_library..s0!L!L3"'//#"6"6!L!L!L!L!L!Lr$z .cobjectsc3TK|]#}tj|V$dSrurrs r#rz-build_clib.build_a_library..s0!J!J3"'//#"6"6!J!J!J!J!J!Jr$wb)rrr/)=r;rdr0rrlistr rRrgrr=r!rB is_cachedrrr rGrcrK compiler_typerNr<rUget_option_dictrlupdaterTrrrrrwr rYrZdirnamerjr\r8r[rcpu_baseline_flags try_dispatchr^compile cxx_compilermodule_dir_switchrmodule_optionsr]isfileremove move_filerwarncan_ccompiler_linkopenwritestatic_lib_extensioncreate_static_lib)2r"r3r2r/r;rr. c_sources cxx_sources f_sourcesfmodule_sourcesrOrlib_filer force_rebuildrrKdistbase_config_fcrrrrrrmodule_build_dircopt_c_sourcescopt_cxx_sourcescopt_baseline_flags copt_macrosbsrc_dirrCcopt_build_src_srcs_dstobjectsr cxx_objects f_objectsexisting_modulesftlistfn lib_fnameclib_librarieslnamebinforrs2 @@r#r|zbuild_clib.build_a_librarys =$ ..++ ?+g"6"6?%(DGO'PQQ Qw--W%% ; ; ?,,,5 NN:s + +u 4   )  # #C ( ( (  +  # #E * * *  +  # #E * * * *  +  # #E * * *)9 %&,,X8<-IIJNN9b999 ( !1B1L1L1N1N ! IB C C C M 8Wh!H!H 8 I:H E E E F H,h 7 7 7NN;33  Y HH! $ % % % @ ? ? ? ? ?% y/F.2l.2l,0J1;15 @@@I $(!%!5!5k!B!B!G!G!I!I%%i000##N333  P Pi.? "BEM"OPP P  /9~~(0*0*00-/  ,/9~~(0*0*00-/  ,)) >F!~~n55  L,, NN0 1 133** NN> * *,, ,, NN+ , ,.. 244555 nn]339r 7??844  * KK( ) ) )  !V + +  $IK N *L  ( @11+>>HHW\\'; JJNW\\(NCCN    / / /%)\?TTxN~/?@[)+;68&  !tT "D!%aaaDD #'"3"F"F"H"H     > ? ? ?   H: ; ; ; t(55?& +)j->&6   G  > H8 9 9 9 t(55?& +)j- <6>> >G  / H* + + + x''? +)j . 3!4 ,!- (// /G  ( H, - - -#0022L&..? +)j . 3!4 .!/ /11K NN; ' ' ' , , NI 3.6'+G}}$)":":!1#3#33 N>???Y..:>/6<L /NNN  :d.@Hg : :A,,,  %5q99Awq))RW__Q-?-??? w~~a((% ! :q*:;;;;-:::$%AA'7'7"9:::::: N4555Y..y:>/6<L /NNN I  9Y99(CC 9W\\$/"*["8::Ffc"" Na !L!L)!L!L!LLLMMM N N N N N N N N N N N N N N NW\\$/"*["8::Ffc"" La !J!J'!J!J!JJJKKK L L L L L L L L L L L L L L L T_%-0M%MOOIi&& !                NN9 % % %  & &w26/-1Z ' 9 9 9 $ R88% B BLE5&&%%eii R&@&@AAA  5&4J{ # # # 5 5sH]$^^3aaa3cccd--d14d1N)__name__ __module__ __qualname__ descriptionr user_optionsboolean_optionsrr)r4r6rsrzrerr|rr$r#rrsEK!.222L %45556O))) $ $ $  X,X,X,tBBB0A5A5A5A5A5r$r)__doc__rYrrkdistutils.command.build_clibrrdistutils.errorsrrrnumpy.distutilsrdistutils.dep_utilr numpy.distutils.misc_utilr r r r rrnumpy.distutils.ccompiler_optrr_lrangelen_irr$r#rs  EEEEEE ******<;;;;;  %B..11B "vay000R&)c/#bfQRRj02{5{5{5{5{5{5{5{5{5{5r$