f: ddlZddlZddlZddlTddlmZddlmZddlm Z ddl m Z ddl m Z mZddlmZGd d Zd Zdd Zd dddddZdZddZdZdZdS)N)*)spawn) move_file)mkpath) newer_group) split_quotedexecute)logceZdZ dZdZdZdZdZdZdZ dZ ddddddZ gdZ d@dZ d Zd Zd Zd ZdAd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dAdZ!dZ"dZ#dZ$d Z% dBd!Z& dCd"Z'd#Z( dDd$Z)d%Z*d&Z+d'Z, dEd(Z- dEd)Z. dEd*Z/ dFd+Z0d,Z1d-Z2d.Z3 dGd/Z4dHd0Z5dId2Z6dId3Z7dId4Z8 dJd6Z9dKd8Z:d9Z;d:Zd=Z?dMd?Z@dS)N CCompilerNcc++objc).cz.ccz.cppz.cxxz.m)rrr rc ||_||_||_d|_g|_g|_g|_g|_g|_g|_ |j D]#}| ||j |$dSN) dry_runforceverbose output_dirmacros include_dirs libraries library_dirsruntime_library_dirsobjects executableskeysset_executable)selfrrrkeys :/opt/alt/python311/lib64/python3.11/distutils/ccompiler.py__init__zCCompiler.__init__Us     %'! #((** < K  DAw$ FAAtr$c  |D]~}t|trOt|dvr>t|dts|dt|dtst d|zdzdzdS)N)r1r1rzinvalid macro definition '%s': z.must be tuple (string,), (string, string), or z(string, None))r,tuplelenr- TypeError)r definitionsr4s r"_check_macro_definitionsz"CCompiler._check_macro_definitionss   ( (DtU++ (YY&((!47C00)48GOQ--5D!BT!IF!G&!'(((5D ( (r$c~ ||}||j|=|j||fdSrr5rappend)r r2r/r3s r" define_macrozCCompiler.define_macrosJ    d # # = A D%=)))))r$c ||}||j|=|f}|j|dSrr>)r r2r3undefns r"undefine_macrozCCompiler.undefine_macrosM    d # # = A 6"""""r$c< |j|dSr)rr?r dirs r"add_include_dirzCCompiler.add_include_dir&   %%%%%r$c& |dd|_dSrrr dirss r"set_include_dirszCCompiler.set_include_dirss !Gr$c< |j|dSr)rr?)r libnames r" add_libraryzCCompiler.add_librarys%  g&&&&&r$c& |dd|_dSr)r)r libnamess r" set_librarieszCCompiler.set_librariess "!!!r$c< |j|dSr)rr?rEs r"add_library_dirzCCompiler.add_library_dirrHr$c& |dd|_dSr)rrKs r"set_library_dirszCCompiler.set_library_dirs s !Gr$c< |j|dSr)rr?rEs r"add_runtime_library_dirz!CCompiler.add_runtime_library_dirs&  !((-----r$c& |dd|_dSr)rrKs r"set_runtime_library_dirsz"CCompiler.set_runtime_library_dirss %)G!!!r$c< |j|dSr)rr?)r objects r"add_link_objectzCCompiler.add_link_object s% F#####r$c& |dd|_dSr)r)r rs r"set_link_objectszCCompiler.set_link_objects(s qqqz r$c ||j}n$t|tstd||j}n1t|t r ||jpgz}ntd||j}nEt|t tfrt ||jpgz}ntd|g}||d|}t||}i} tt|D]p} || } || } tj | d} |tj | | | f| | <q||||| fS)N%'output_dir' must be a string or None/'macros' (if supplied) must be a list of tuples6'include_dirs' (if supplied) must be a list of stringsr) strip_dirrr1)rr,r-r:rlistrr8object_filenamesgen_preprocess_optionsranger9ospathsplitextrdirname)r outdirrincdirssourcesdependsextrarpp_optsbuildr3srcobjexts r"_setup_compilezCCompiler._setup_compile6sI >_FFFC(( ECDD D >[FF  % % Ot{0b1FFMNN N ?'GG $ / / L7mmt'8'>B?GGJLL L =E''139(;;)99s7||$$ $ $A!*C!*C'""3''*C KK,, - - -sE#JJww55r$c8|dgz}|rdg|dd<|r||dd<|S)Nz-cz-gr)r rsdebugbeforecc_argss r" _get_cc_argszCCompiler._get_cc_argsas?TF"  !&GBQBK  ! GBQBKr$c~ ||j}n$t|tstd||j}n1t|t r ||jpgz}ntd||j}nEt|t tfrt ||jpgz}ntd|||fS)Nrbrcrd)rr,r-r:rrfrr8)r rrrs r"_fix_compile_argszCCompiler._fix_compile_argsjs   JJJ,, ECDD D >[FF  % % Ot{0b1FFMNN N  ,LL  tUm 4 4 L --1B1HbILLJLL L6<//r$c: |||}|ifS)N)r)rg)r rprrqrs r" _prep_compilezCCompiler._prep_compiles- ''J'GG {r$c t|ttfstdt|}||j}n$t|t std||fS)Nz,'objects' must be a list or tuple of stringsrb)r,rfr8r:rr-)r rrs r"_fix_object_argszCCompiler._fix_object_argssv 'D%=11 LJKK Kw--  JJJ,, ECDD D$$r$c ||j}nEt|ttfrt||jpgz}nt d||j}nEt|ttfrt||jpgz}nt d||j}nEt|ttfrt||jpgz}nt d|||fS)Nz3'libraries' (if supplied) must be a list of stringsz6'library_dirs' (if supplied) must be a list of stringsz>'runtime_library_dirs' (if supplied) must be a list of strings)rr,rfr8r:rr)r rrrs r" _fix_lib_argszCCompiler._fix_lib_argss6  II  D%= 1 1 Ii((DN,@bAIIGII I  ,LL  tUm 4 4 L..$2C2IrJLLJLL L '#'#< ,tUm < < 9$()=$>$>%)%>%D"%F 899 9<)=>>r$cn |jrdS|jrt||d}nt||}|S)NTnewer)missing)rrr)r r output_filers r" _need_linkzCCompiler._need_linksL  : 4| ;#Wk7KKK#Wk::Lr$cP t|ts|g}d}t|j}|D]s}tj|\}}|j|} |j |}||kr|}|}d#t$rYpwxYw|Sr) r,rfr9language_orderrjrkrl language_mapgetindexr&) r rplangrsourcebaserwextlangextindexs r"detect_languagezCCompiler.detect_languages '4(( iGD'((  F((00ID#'++C00G .44W==e##"D$E     s1$B B#"B#c dSrrz)r rrrr extra_preargsextra_postargss r" preprocesszCCompiler.preprocesss  r$c  |||||||\}} }} } || ||} | D]9} | | \}}n#t$rYwxYw|| ||| || :| Sr)rxr~KeyError_compile)r rprrrr{rrrqrrsrtr}rvrurws r"compilezCCompiler.compiles/ f##J g$+^== 8%##GUMBB K KC  :SS     MM#sC.' J J J Js A  AAc dSrrz)r rvrurwr}rrss r"rzCCompiler._compileCs - r$c dSrrz)r routput_libnamerr{ target_langs r"create_static_libzCCompiler.create_static_libIs , r$ shared_objectshared_library executablec trNotImplementedError)r target_descroutput_filenamerrrrexport_symbolsr{rr build_temprs r"linkzCCompiler.linkis* V"!r$c |tj|||d||||||| | | | dS)Nshared)lib_type)rr SHARED_LIBRARYlibrary_filename) r rrrrrrrr{rrrrs r"link_shared_libzCCompiler.link_shared_libs_ )*G'''JJ\+? %[  J J J J Jr$c \|tj||||||||| | | | dSr)rr SHARED_OBJECT) r rrrrrrrr{rrrrs r"link_shared_objectzCCompiler.link_shared_objectsK ))7!:\+? %[  J J J J Jr$c |tj|||||||d||| d| dSr)rr EXECUTABLEexecutable_filename) r routput_prognamerrrrr{rrrs r"link_executablezCCompiler.link_executablesX )&**?;;Z\+?k K K K K Kr$c trrrEs r"library_dir_optionzCCompiler.library_dir_option "!r$c trrrEs r"runtime_library_dir_optionz$CCompiler.runtime_library_dir_optionrr$c trr)r libs r"library_optionzCCompiler.library_optionrr$c ddl}|g}|g}|g}|g}|d|d\}}tj|d} |D]} | d| z| d|z| n#| wxYw ||g|} n#t$rYd SwxYw || d || n#ttf$rYd SwxYwdS) NrrT)textwz#include "%s" z=int main (int argc, char **argv) { %s(); return 0; } rJFza.out)rr) tempfilemkstemprjfdopenwritecloser CompileErrorr LinkErrorr:) r funcnameincludesrrrrfdfnamefinclrs r" has_functionzCCompiler.has_functions    H  L  I  L$$T8$$?? E Ib#     6 6-45555 GG      GGIIIIAGGIIII llE7lFFGG   55    '+4.: ! < < < <9%   55 ts05BB'+C CCC00DDc trr)r rLrr{s r"find_library_filezCCompiler.find_library_file$s "!r$c|d}g}|D]}tj|\}}tj|d}|tj|d}||jvrt d|d|d|rtj|}|tj |||j z|S)Nrr1zunknown file type 'z ' (from 'z')) rjrkrl splitdriveisabssrc_extensionsUnknownFileErrorbasenamer?join obj_extension)r source_filenamesrer obj_namessrc_namerrws r"rgzCCompiler.object_filenamesOs  J ( F FH((22ID#7%%d++A.D d++,,-D$---&&>Acc888LNNN .w''--   RW\\**.1C*CEE F F F Fr$c|rtj|}tj|||jzSr)rjrkrrshared_lib_extensionr rrers r"shared_object_filenamez CCompiler.shared_object_filename`s=  2w''11Hw||J43L(LMMMr$c|rtj|}tj|||jpdzS)Nr)rjrkrr exe_extensionrs r"rzCCompiler.executable_filenamefsB  2w''11Hw||JD4F4L"(MNNNr$staticc|dvrtdt||dz}t||dz}tj|\}}|||fz} |rd}tj||| S)N)rrdylib xcode_stubz?'lib_type' must be "static", "shared", "dylib", or "xcode_stub" _lib_format_lib_extensionr)r&getattrrjrksplitr) r rOrrerfmtrwrFrfilenames r"rzCCompiler.library_filenamels F F F[]] ]dH}455dH'7788GMM'** T$$  Cw||JX666r$r1c.tj|dSr)r r{)r msglevels r"announcezCCompiler.announces #r$c8ddlm}|rt|dSdS)Nr)DEBUG)distutils.debugrprint)r rrs r" debug_printzCCompiler.debug_prints5))))))   #JJJJJ  r$cJtjd|zdS)Nz warning: %s )sysstderrr)r rs r"warnzCCompiler.warns# 3./////r$c4t||||jdSr)r r)r funcargsrrs r"r zCCompiler.executesdC.....r$c2t||jdSN)r)rr)r cmds r"rzCCompiler.spawns c4<((((((r$c0t|||jSr)rr)r rudsts r"rzCCompiler.move_filesc4<8888r$c4t|||jdSr)rr)r r2modes r"rzCCompiler.mkpathstT4<000000r$)rrrr)NNNNN)NNNrNNN)NrN) NNNNNrNNNN)NNNNrNNN)NNNN)r)rr)rrr)r1)Nr1)r )Ar( __module__ __qualname__ compiler_typerrstatic_lib_extensionrstatic_lib_formatshared_lib_formatrrrr#r*rr5r<r@rCrGrMrPrSrUrWrYr[r^r`rxr~rrrrrrrrrrrrrrrrrrrrrrrgrrrrrrr rrrrzr$r"r r s *M4NMM!"""# L *))N"<"<"<"-1BBBBH   EI/3    8$M%NJ "&  9"9"9"9"B$("&%)-1'+&*'+#'$(JJJJ0'+%)(,04*.!")-*.&*'+JJJJ.$("&%)-1&*'+$(KKKK,""" """ """ BF26****X""""V"NNNN OOOO 2:137777& 000////)))999111111r$r ))zcygwin.*unix)posixr)ntmsvcc | tj}| tj}tD]3\}}t j||t j|||cS4dS)Nr)rjr2rplatform_default_compilersrematch)osnamerpatterncompilers r"get_default_compilerrso~</ 8GX & & 2 8GV $ $ 0OOO 1 6r$) unixccompiler UnixCCompilerzstandard UNIX-style compiler) _msvccompiler MSVCCompilerzMicrosoft Visual C++)cygwinccompilerCygwinCCompilerz'Cygwin port of GNU C Compiler for Win32)r#Mingw32CCompilerz(Mingw32 port of GNU C Compiler for Win32) bcppcompiler BCPPCompilerzBorland C++ Compiler)rrcygwinmingw32bcppc ddlm}g}tD].}|d|zdt|df/|||}|ddS)Nr) FancyGetoptz compiler=r7zList of available compilers:)distutils.fancy_getoptr,compiler_classrr?sort print_help)r, compilersrpretty_printers r"show_compilersr3s 322222I"''))88+h.(2157 8 8 8 8 NN [++N<=====r$c | tj} |t|}t|\}}}n,#t$rd|z}||d|zz}t |wxYw d|z}t |tj|} t| |} n?#t$rtd|zt$rtd|d|dwxYw| d||S)Nz5don't know how to compile C/C++ code on platform '%s'z with '%s' compilerz distutils.z4can't compile C/C++ code: unable to load module '%s'z0can't compile C/C++ code: unable to find class 'z ' in module '') rjr2rr.rDistutilsPlatformError __import__rmodulesvars ImportErrorDistutilsModuleError) platrrrr module_name class_namelong_descriptionrmoduleklasss r" new_compilerrBsO  |w *  +D11H6DX6N3j"2"2 ***EL  -88C$S))) * ="[0 K   [)V Z( "D  ===""#-::{{{<== == 5w & &&s"4)A!;BrSso1 !!!!!!))))))%%%%%%******00000000E1E1E1E1E1E1E1E1X 0?7JK7  >>>"*'*'*'*'Z***Z$$$$$r$