\bgM<dZddlmZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl m Z ddlmZdd lmZmZmZdd lmZdd lmZmZmZmZd Zd ZdZGddeZdS)a9distutils.unixccompiler Contains the UnixCCompiler class, a subclass of CCompiler that handles the "typical" Unix-style command-line C compiler: * macros defined with -Dname[=value] * macros undefined with -Uname * include search directories specified with -Idir * libraries specified with -lllib * library search directories specified with -Ldir * compile handled by 'cc' (or similar) executable with -c option: compiles .c to .o * link static library handled by 'ar' command (possibly with 'ranlib') * link shared library handled by 'cc -shared' ) annotationsN) sysconfig)log)compiler_fixup)newer) CCompilergen_lib_optionsgen_preprocess_options)consolidate_linker_args) CompileErrorDistutilsExecErrorLibError LinkErrorcd}tj|ddkrd}d||vr|dz }d||v|d|||dfS)z For macOS, split command into 'env' portion (if any) and the rest of the linker command. >>> _split_env(['a', 'b', 'c']) ([], ['a', 'b', 'c']) >>> _split_env(['/usr/bin/env', 'A=3', 'gcc']) (['/usr/bin/env', 'A=3'], ['gcc']) renvr=Nospathbasenamecmdpivots t/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/setuptools/_distutils/unixccompiler.py _split_envr0sq E wA5((SZ QJESZ vv;EFF ##c|tj|ddk}|d|||dfS)a AIX platforms prefix the compiler with the ld_so_aix script, so split that from the linker command. >>> _split_aix(['a', 'b', 'c']) ([], ['a', 'b', 'c']) >>> _split_aix(['/bin/foo/ld_so_aix', 'gcc']) (['/bin/foo/ld_so_aix'], ['gcc']) r ld_so_aixNrrs r _split_aixr Bs= G  SV $ $ 3E vv;EFF ##rcXt|}|d||kr|nd}||dS)a The linker command usually begins with the compiler command (possibly multiple elements), followed by zero or more params for shared library building. If the LDSHARED env variable overrides the linker command, however, the commands may not match. Return the best guess of the linker parameters by stripping the linker command. If the compiler command does not match the linker command, assume the linker command is just the first element. >>> _linker_params('gcc foo bar'.split(), ['gcc']) ['foo', 'bar'] >>> _linker_params('gcc foo bar'.split(), ['other']) ['foo', 'bar'] >>> _linker_params('ccache gcc foo bar'.split(), 'ccache gcc'.split()) ['foo', 'bar'] >>> _linker_params(['gcc'], ['gcc']) [] Nr)len) linker_cmd compiler_cmdc_lenrs r_linker_paramsr&Ps<.   E'<77EEQE eff rc BeZdZdZddgdgdgdgddgddgdgddgddgdd Zejdd d krd ged <gd Zd ZdZ dZ dZ dZ dxZ xZZeZejdkrdZdZ dZ dZ d'dZdZ d(dZ d)dZdZdZd*d#Zd$Zed%Zd+d&ZdS), UnixCCompilerunixNccc++z-sharedarz-cr) preprocessorcompiler compiler_so compiler_cxxcompiler_so_cxx linker_so linker_so_cxx linker_exelinker_exe_cxxarchiverranlibdarwinr7)z.cz.Cz.ccz.cxxz.cppz.mz.oz.az.soz.dylibz.tbdzlib%s%scygwinz.exez.dll.az.dllzcyg%s%sc$|d||}|\}}}t||} |j| z} |r| d|g|r|| dd<|r| || ||jp|dupt ||} | sdS|r2|tj | | | dS#t$r} t| d} ~ wwxYw)N-or)_fix_compile_argsr r-extendappendforcermkpathrrdirnamespawnrr ) selfsource output_filemacros include_dirs extra_preargsextra_postargs fixed_argsignorepp_optspp_args preprocessmsgs rrOzUnixCCompiler.preprocesssD++D&,GG '1$ (>>#g-  0 NND+. / / /  ('GBQBK  + NN> * * *v ZT;$#6T% :T:T   F  6 KK 44 5 5 5 $ JJw     ! $ $ $s## # $sC11 D;D  Dcdt|j||z}t|j||z} ||dkr#|||z|d|gz|zdS|||z|d|gz|zdS#t $r} t | d} ~ wwxYw)Nr+r<)rr/r1detect_languagerCrr ) rDobjsrcextcc_argsrJrMr/r1rPs r_compilezUnixCCompiler._compiles$T%5w7OPP ()=w?WXX $##C((E11 #g-dC0@@>Q ;0Cs3CCnTUUUUU! $ $ $s## # $s:B.!B B/B**B/Fc|||\}}|||}|||r|tj|||j|gz|z|j z|j rB ||j |gzdS#t$r}t|d}~wwxYwdStjd|dS)N) output_dirskipping %s (up-to-date))_fix_object_argslibrary_filename _need_linkrArrrBrCr6objectsr7rrrdebug)rDr^output_libnamerYr_ target_langoutput_filenamerPs rcreate_static_libzUnixCCompiler.create_static_libs#33GZHH//:/VV ??7O 4 4 C KK88 9 9 9 JJt}'887BT\Q R R R{ ((JJt{o->>?????)((("3--'( ( ( I0/ B B B B Bs*C C(C##C(cj|||\}}||||}|\}}}t||||}t|tt dfst d| tj ||}| ||ri||j z|zd|gz}| rdg|dd<| r| |dd<| r| | | tj| |tjk}|r|jn| dkr|jn|jdd}| dkrt|jrmt+|\}}t-|\}}t+|j\}}t+|j\}}t/||}||z|z|z}t1||}|||zdS#t4$r}t7|d}~wwxYwt9jd|dS)Nz%'output_dir' must be a string or Noner<z-grr+rZ)r[ _fix_lib_argsr isinstancestrtype TypeErrorrrjoinr]r^r>rArBr EXECUTABLEr4r3r2r0rr r&rrCrrrr_)rD target_descr^rbrY libraries library_dirsruntime_library_dirsexport_symbolsr_rIrJ build_temprarKlib_optsld_args building_exelinkerr linker_neaix linker_na_compiler_cxx_ne linker_exe_neparamsrPs rlinkzUnixCCompiler.linksv #33GZHH'' !rc d|zS)Nz-lr)rDlibs rlibrary_optionzUnixCCompiler.library_optionYrrcvtjd}tjd|}tjdkoA|o?|dp*|do|d }|r;tj | d|ddn|S) a macOS users can specify an alternate SDK using'-isysroot'. Calculate the SDK root if it is specified. Note that, as of Xcode 7, Apple SDKs may contain textual stub libraries with .tbd extensions rather than the normal .dylib shared libraries installed in /. The Apple compiler tool chain handles this transparently but it can cause problems for programs that are being built with an SDK and searching for specific libraries. Callers of find_library_file need to keep in mind that the base filename of the returned SDK library file might have a different extension from that of the library file installed on the running system, for example: /Applications/Xcode.app/Contents/Developer/Platforms/ MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/ usr/lib/libedit.tbd vs /usr/lib/libedit.dylib CFLAGSz-isysroot\s*(\S+)r9z/System/z/usr/z /usr/local/rN) rrresearchrr startswithrrrjgroup)rcflagsmatch apply_roots r _library_rootzUnixCCompiler._library_root\s*)(33 .77 LH $  z**SNN7++QCNN=4Q4Q0Q 9CKrw||EKKNNCG444Krc>fddD}tj|}tjt jjtj||}tt jj |}t|dS)z Second-guess the linker with not much hard data to go on: GCC seems to prefer the shared library, so assume that *all* Unix C compilers do, ignoring even GCC's "-static" option. c3FK|]}|VdS))lib_typeN)r\).0rhrrDs r z2UnixCCompiler.find_library_file..sJ    ! !# ! 5 5      rzdylib xcode_stub shared staticN) rmapr itertoolsstarmaprrrjproductfilterexistsnext)rDdirsrr_ lib_namesrootssearchedfounds` ` rfind_library_filezUnixCCompiler.find_library_files     8>>@@   D&--$RW\93DUI3V3VWWrw~x00E4   r)NNNNN)NFN) NNNNNFNNNN)rrgrr)F)__name__ __module__ __qualname__ compiler_type executablesrrsrc_extensions obj_extensionstatic_lib_extensionshared_lib_extensiondylib_lib_extensionxcode_stub_lib_extensionstatic_lib_formatshared_lib_formatdylib_lib_formatxcode_stub_lib_format exe_extensionrOrWrcr}rrrr staticmethodrrrrrr(r(lsMFv!7I&+f ),5M  K |BQB8##!) H?>>NM "%?HHH),<, |x '$$ #$#$#$#$J $ $ $RVCCCC:!?C?C?C?CJ666 &"&"&"&"P L L\ LD!!!!!!rr()__doc__ __future__rrrrrrr_logr _macos_compatr _modifiedr ccompilerr r r compatr errorsr rrrrr r&r(rrrrsZ  #""""" ))))))IIIIIIIIII++++++IIIIIIIIIIII$$$$$ $ $ $8f!f!f!f!f!If!f!f!f!f!r