bgoddlZddlZddlZddlZddlZddlZddlZddlmZddlm Z ddl m Z ddl m Z mZmZmZmZddlmZmZmZmZmZddlmZddlmZdd lmZdd lmZm Z dd l!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'ddl(Z(da)e(j*Z+e,Z-d Z.d Z/dZ0e/ede0dBdZ1e/ede1dCdZ2e/ede2 dDdZ3e/ede3dEdZ4e/ede4dZ5dZ6e/ede6dFdZ7e/ede7dGd Z8d!dgfd"Z9e/ed#e9d$Z:e/ed%e:d&e d'<d(e d)<d*e d+<d,e d-<d.e d/<d0e d1<d2e d3<d4e d5<e xj;d6z c_;ejd7kr.d8e d9<e$rej<d:d;e j;ze _;eZ= dHd<Zee _eZ>d=Zee _d>D]1Z?ej@Ad?e?zd@zZBeB eCeBdAe2dS)IN)copy)Path) ccompiler)compiler_classgen_lib_optionsget_default_compiler new_compiler CCompiler)DistutilsExecErrorDistutilsModuleErrorDistutilsPlatformError CompileErrorUnknownFileError)customize_compiler) LooseVersion)log)filepath_from_subprocess_outputforward_bytes_to_stdout) cyg2win32 is_sequencemingw32get_num_build_jobs_commandline_dep_stringsanitize_cxx_flagsc&|dz}tj|sdSt|5}|}dddn #1swxYwYt |||}|d}||krdSd|dd} dtj| dD} tj |j } | D]"}tj |j | krdS#n#t$rYdSwxYwdS) z Check if an objects needs to be rebuild based on its dependencies Parameters ---------- obj : str object file Returns ------- bool .dTNcHg|]}|dk|d| S) :)endswith).0xs l/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib64/python3.11/site-packages/numpy/distutils/ccompiler.py z _needs_build..Gs6 2 2 2!DyyCy yy)posixF) ospathexistsopen readlinesrjoinshlexsplitstatst_mtimeOSError) objcc_argsextra_postargspp_optsdep_fileflinescmdline last_cmdlinecontentsdepst_objs r% _needs_buildr@'s~TzH 7>>( # #t h1 %Wng F FG9LwtwwuSbSz""H 2 2u{84888 2 2 2D  %  Awqzz"U**tt+  tt 5s)AAA;D>D D Dc4fd}t|||dS)Nc|g|Ri|SN)selfargskwfuncs r%z replace_method..[s!$$t"9d"9"9"9b"9"9r')setattr)klass method_namerHms ` r%replace_methodrNYs)9999A E;"""""r'cdS)z Does nothing here, but is called by the get_version method and can be overridden by subclasses. In particular it is redefined in the `FCompiler` class where more documentation can be found. NrDrEs r%CCompiler_find_executablesrQds  Dr'find_executablesc\||nttj}|3|}t|r"dt |}t j| |jrtj ||n!tj |tj |dS#tj $r}|j }|j}Yd}~nmd}~wt$r]}d|d} |t"jj}n%#t($r|d}YnwxYwd}Yd}~nd}~wwxYwt|r"dt |}|jrt+|t-jd |rd }nd }t1d |||fz) a Execute a command in a sub-process. Parameters ---------- cmd : str The command to execute. display : str or sequence of str, optional The text to add to the log file kept by `numpy.distutils`. If not given, `display` is equal to `cmd`. env : a dictionary for environment variables, optional Returns ------- None Raises ------ DistutilsExecError If the command failed, i.e. the exit status was not 0. N )env)stderrrUz z utf8sToo many open filesz2 Try rerunning setup command until build succeeds.rz)Command "%s" failed with exit status %d%s)dictr)environrr.listrinfoverbose subprocess check_outputSTDOUTCalledProcessErroroutput returncoder3encodesysstdoutencodingAttributeErrorrresearchr ) rEcmddisplayrUexcosemsgs r%CCompiler_spawnrrrs.##d2:&6&6C w   .hhtG}}--GHW < L  #CS 1 1 1 1 1  #C 0As K K K K.t-  ( J N  1    !,--AA ! ! !  AAA ! *3"hhtCyy!! |#""" y'++C H !SM* + ++sH(?B))D58C  D5D0$DD0D&#D0%D&&D00D5spawnrc0|d}g}|D]}tjtj|\}}tj|d}|tj|d}|drk|ddz}|d|} tjtj | } | ||dz}||j vrtd|d|d|rtj|}tj |||j z} || |S) a Return the name of the object files for the given source files. Parameters ---------- source_filenames : list of str The list of paths to source files. Paths can be either relative or absolute, this is handled transparently. strip_dir : bool, optional Whether to strip the directory from the returned paths. If True, the file name prepended by `output_dir` is returned. Default is False. output_dir : str, optional If given, this path is prepended to the returned paths to the object files. Returns ------- obj_names : list of str The list of paths to the object files corresponding to the source files in `source_filenames`. Nrz..zunknown file type 'z ' (from 'z'))r)r*splitextnormpath splitdriveisabs startswithrfindbasenameabspathsrc_extensionsrr. obj_extensionappend) rEsource_filenames strip_dir output_dir obj_namessrc_namebaseextidobj_names r%CCompiler_object_filenamesrsw. I$##G$$RW%5%5h%?%?@@ cw!!$''*BGMM$''(() ??4   4  "ARaRA  !3!344AtABBx.single_compile4slZc3C.'BB  F   ///%))#...        /                JsOOO  . O O c3WngNNN O O O O O O O O O O O O O O O . .!((--- . . . . . . . . . . . . . . . . . . . .!((--- . . . . . . . . . . . . . . . .sw%A$$A(+A(C: B3' C:3B77C::B7;C:C--C14C1:D5D) D5)D- -D50D- 1D5absoftru)ThreadPoolExecutor)rrr threading Semaphorenumpy.distutils.fcompilerrrr isinstancegetattrrr. compiler_sorr\_setup_compile _get_cc_argsr[keys compiler_typerrsuffixloweritemslenconcurrent.futuresrmap)!rEsourcesrmacros include_dirsdebug extra_preargsr6dependsjobsrrrrlfcfcompccompobjectsbuildrobjects_to_build f77_objects other_objectsr4rr build_itemsrnrpoolresr5r7s!` ` @@r%CCompiler_compilers>P   D 77  !&066N777777777777777  ;;;;;;;;;;$ "" :' N NBD+b.11E} NNNCHHUOOOL M M M M))G$$ (+9HW    FL' ' 9 94FG^We >>G%'):):;GH*chh~.F.FGGHW........6$ ""$ --%']  < #..O&&c3Z'89999!((#Sz):;;;"   A N1     kkmm  5zzA~~$((999999   % % 8((>;77C 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 S   A N1     Ns#AA A1KKKcompilerDctjd|jjdjjt |drjd|jdvr[t jdkrtjdks4|j d|j dfd }|d r| j |d r#j D]\}}||||d rjD]}|||d r"||jjz|dr"||jjz|dr|j|dr|jdSdS)a Customize compiler using distutils command. Parameters ---------- cmd : class instance An instance inheriting from `distutils.cmd.Command`. ignore : sequence of str, optional List of `CCompiler` commands (without ``'set_'``) that should not be altered. Strings that are checked for are: ``('include_dirs', 'define', 'undef', 'libraries', 'library_dirs', 'rpath', 'link_objects')``. Returns ------- None z customize z using compilerclangrarm64darwinz-ftrapping-mathc2t|dduo|vSrC)r)attrrkignores r%allowz&CCompiler_customize_cmd..allows$sD$''t3JF8JJr'rdefineundef libraries library_dirsrpath link_objectsN)rr\ __class____name__hasattrrplatformmachinererrset_include_dirsrr define_macrorundefine_macro set_librariesrset_library_dirsrset_runtime_library_dirsrset_link_objectsr)rErkrrnamevaluemacros `` r%CCompiler_customize_cmdrxs9&HH(?(?(?(+ (>(>@AAA j!! 34=###    7 * *s|x/G/G .///  1222KKKKKK u^0 c./// uX+ Z + +MT5   dE * * * * uW~~'Y ' 'E    & & & & u[; 4>CM9::: u^D d/#2BBCCC uW~~1 %%ci000 u^0 c./////00r' customize_cmdcg}d}t|j}dD]}||vr|||D]c}t ||rQt ||}t |t|}||t|fddt|dzzdzfd|D}d |S)Nr) versionrr object_switchcompile_switchrrrrrz%-ruzs = %scg|]}|zSrDrD)r#propfmts r%r&z'_compiler_to_string..s * * *DS4Z * * *r'r ) r[ executablesrrrrmaxrreprr.)rpropsmxrkeyvr:rs @r%_compiler_to_stringrs E B $))++ , ,DL d?? KK   )) 8S ! ! )#&&ARS""B LL#tAww ( ( ( bd h &C * * * *E * * *E 99U  r'c |n#t$rYnwxYwtjjdkrPt dt |jt t|t ddSdS)z Print the compiler customizations to stdout. Parameters ---------- None Returns ------- None Notes ----- Printing is only done if the distutils log threshold is < 2. rvzP********************************************************************************N) get_version Exceptionr _global_log thresholdprintrrrPs r%CCompiler_show_customizationrs"          "" f  dn !$''((( f #"s  $$show_customizationctjd|jjzt ||r |jdn#ttf$rYnwxYwt|dryd|j dvrj|j sb|j d drd\}}nd\}}|j d ||g|j d d z|_ n^t|drtjd |j d t|d s!tjd|jjzt|dr5d|j dvsd|j dvsd|j dvrd|_nt jdkrdd l}dd l}|} t j|d}t/|d5} | dd d d n #1swxYwY||g|dd|dzgd|_n#t4$r d|_YnwxYw||n#||wxYwd S)am Do any platform-specific customization of a compiler instance. This method calls `distutils.sysconfig.customize_compiler` for platform-specific customization, as well as optionally remove a flag to suppress spurious warnings in case C++ code is being compiled. Parameters ---------- dist : object This parameter is not used for anything. need_cxx : bool, optional Whether or not C++ has to be compiled. If so (True), the ``"-Wstrict-prototypes"`` option is removed to prevent spurious warnings. Default is False. Returns ------- None Notes ----- All the default options used by distutils can be extracted with:: from distutils import sysconfig sysconfig.get_config_vars('CC', 'CXX', 'OPT', 'BASECFLAGS', 'CCSHARED', 'LDSHARED', 'SO') z customize %sz-Wstrict-prototypesrccrgcc)rg++)rzc++ruNz#### z ####### compiler_cxxzMissing compiler_cxx fix for rrTr(zfile.cwzint a; z-MMDz-MFr)rrF)rr\rrrrrrh ValueErrorrrrr{replacewarn _auto_dependsr)rtempfileshutilmkdtempr*r.r,writerrrmtree) rEdistneed_cxxabrr tmpdirfnr9s r%CCompiler_customizers>H^t~6 7888tT    # #$9 : : : : +    D  4 $ $ Tq1A)A)A$ 8=#..u55''DAqq&DAq%)]1%5%=%=a%C%C$D&*mABB&7%8!tZ(( ?dmmm=>>>400 T84>;RRSSS tZ  "et}Q/?&?&?&+t}Q/?&?&?&-q1A&A&A! G   !!## "fh//Bb# $! ### $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ LL"&(.rDy'A  C C C!%D   ' ' '!&D    ' MM& ! ! ! !FMM& ! ! ! ! Fs_AA$#A$0I0H IHIH)II1II1II11J customize[-.\d]+cfd}|S)aU Simple matching of version numbers, for use in CCompiler and FCompiler. Parameters ---------- pat : str, optional A regular expression matching version numbers. Default is ``r'[-.\d]+'``. ignore : str, optional A regular expression matching patterns to skip. Default is ``''``, in which case nothing is skipped. start : str, optional A regular expression matching the start of where to start looking for version numbers. Default is ``''``, in which case searching is started at the beginning of the version string given to `matcher`. Returns ------- matcher : callable A function that is appropriate to use as the ``.version_match`` attribute of a `CCompiler` class. `matcher` takes a single parameter, a version string. c|dd}d}r-tj|}|sdS|} tj||d}|sdSr=tj|dr|}a |dS)Nr rTr)rrimatchendrjgroup)rEversion_stringposrMrpatstarts r%matcherz%simple_version_match..matcherLs(//c::  //A t%%''C  #~cdd344A t "(61771::66 eegg wwqzzr'rD)rrrrs``` r%simple_version_matchr 2s/4& Nr'FcJ |st|dr|jS| |j}n#t$rYdSwxYw|r|dsdS |j}n0#t$r# |j n#t$rYYdSwxYw fd}YnwxYw tj|tj }t|}d}n9#tj $r}|j }|j }Yd}~nd}~wt$rd}d}YnwxYwd}||vr||}|rt|}||_|S)a Return compiler version, or None if compiler is not available. Parameters ---------- force : bool, optional If True, force a new determination of the version, even if the compiler already has a version attribute. Default is False. ok_status : list of int, optional The list of status values returned by the version look-up process for which a version string is returned. If the status value is not in `ok_status`, None is returned. Default is ``[0]``. Returns ------- version : str or None Version string, in the format of `distutils.version.LooseVersion`. rNrcdtj|}|sdS|d}|S)Nr)rirr)rrMrrs r%rz&CCompiler_get_version..matchers7n--A tggi((GNr')rVrXr')rrrR version_cmdrh version_matchversion_patternr^r_r`rrarbrcr3r) rEforce ok_statusr#rrbstatusrmrrs @r%CCompiler_get_versionr)as( WT9--|& tt k!nt $     &CC   444         (Z=NOOO188  (     G '&//  ,"7++GDL Nsc8 AAA B )A10B 1 B;B ?BB  B  CC7C##C76C7rc|jdvr|St|}|j|_|jdgt|jddz|_t jdr>d|jdvr/|jd|jdg|jddz|_t jdrO|j d |j d |j d n#|jdg|jddz|_|S) z Return the C++ compiler. Parameters ---------- None Returns ------- cxx : class instance The C++ compiler, as a `CCompiler` instance. )msvcintelwintelemwrruN)aixos400 ld_so_aixrvr/z-D__STDC_FORMAT_MACROSz-fno-extern-tls-init) rrrrrrerr{ linker_sor)rEcxxs r%CCompiler_cxx_compilerr3s< ;;; t**C'C'*+()<==>CO  011, 3=+ + +q)3+;A+>?-+,  |w''B 7888 5666 34444)!,- abb0AA Jr' cxx_compiler)intelccompilerIntelCCompilerz(Intel C Compiler for 32-bit applicationsintel)r5IntelItaniumCCompilerz7Intel C Itanium Compiler for Itanium-based applicationsintele)r5IntelEM64TCCompilerz(Intel C Compiler for 64-bit applicationsintelem)r5IntelCCompilerWz3Intel C Compiler for 32-bit applications on Windowsr,)r5IntelEM64TCCompilerWz3Intel C Compiler for 64-bit applications on Windowsr-) pathccompilerPathScaleCCompilerz2PathScale Compiler for SiCortex-based applicationspathcc) armccompiler ArmCCompilerzArm C Compilerarm)fujitsuccompilerFujitsuCCompilerzFujitsu C Compilerfujitsu))linux.*r7)rGr9)rGr;)rGr@)ntr,)rHr-win32)mingw32ccompilerMingw32CCompilerz>Mingw32 port of GNU C Compiler for Win32(for MSC built Python)rz+Setting mingw32 as default compiler for nt.))rHrcP|!tjtjk}| tj} |t |}t |\}}}n,#t$rd|z}||d|zz}t|wxYwd|z} t|n#t$r} t| }tj dt||dd} t|n3#t$r&} t| }td|zd} ~ wwxYwYd} ~ nd} ~ wwxYw tj|} t!| |} n$#t$rtd|d|d wxYw| d||}||_tjd | z|S) Nz5don't know how to compile C/C++ code on platform '%s'z with '%s' compilerznumpy.distutils.z,%s in numpy.distutils; trying from distutilsz4can't compile C/C++ code: unable to load module '%s'z0can't compile C/C++ code: unable to find class 'z ' in module ''znew_compiler returns %s)r get_thresholdINFOr)rrrKeyErrorr __import__ ImportErrorstrr\r remodulesvarsr]r) platrr]dry_runr& module_name class_namelong_descriptionrqrpmodulerKs r%r r s$ #%%1 |w*  +D11H6DX6N3j"2"2 ***EL  -88C$S))) * %{2K K       !ff ?S   !!""o   { # # # #   a&&C&'](   $ # # # # >[)V Z( >>>""$.JJ $=>> >>uT7E**HHI'51222 OsS"A)A?B D+";D&C.-D&. D8!DDD&&D+/'E!E8ct||||}g}|D]I}t|r#|t|4||J|SrC)_distutils_gen_lib_optionsrextendr[r)rrruntime_library_dirsrrlib_optsrs r%rr su #8\#7 D DAH  q>>  OODGG $ $ $ $ OOA     Or')msvc9r+_msvcbcppcygwincemxcunixcz distutils.rr)NN)rr)NNNrNNN)rD)r)rrr)NNNrr)Dr)rirerr/rr^rpathlibr distutilsrdistutils.ccompilerrrrr r distutils.errorsr r r rrdistutils.sysconfigrdistutils.versionrnumpy.distutilsrnumpy.distutils.exec_commandrrnumpy.distutils.misc_utilrrrrrrrrLockrsetrr@rNrQrrrrrrrrr r)r3_default_compilersr\_distutils_new_compilerr^_ccrUget_mrJrDr'r%rysH  322222******9999999999999999 y~ CEE///d###   y,.HIIIE+E+E+E+Ny'?333++++Zy,.HIII=A@D37JJJJXy)%677740404040ly/+BCCC$6y.0LMMMO O O O by+':;;;----^',sAAAAFy-)>???"""Hy.*@AAAGwWxIySxUzRx.u2y !55<7!;N9wyyF >???';)2)E(F $' ****X& ,",  J88C +j8 9 9B ~%77788r'