a ª‡Ù`¢9ã@s’dZddlZddlZddlZddlmZddlmZddlm Z m Z m Z ddl m Z mZmZmZddlmZejdkr~ddlZGd d „d e ƒZdS) 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' éN)Ú sysconfig)Únewer)Ú CCompilerÚgen_preprocess_optionsÚgen_lib_options)ÚDistutilsExecErrorÚ CompileErrorÚLibErrorÚ LinkError)ÚlogÚdarwinc @sÜeZdZdZddgdgdgddgdgddgddœZejdd…d krNd ged <gd ¢Zd Zd Z dZ dZ dZ dZ ZZeZejdkrˆdZd'dd„Zdd„Zd(dd„Zd)dd„Zdd„Zdd „Zd!d"„Zd#d$„Zd*d%d&„ZdS)+Ú UnixCCompilerÚunixNÚccz-sharedÚarz-cr)Ú preprocessorÚcompilerÚ compiler_soÚ compiler_cxxÚ linker_soÚ linker_exeÚarchiverÚranlibér r)z.cz.Cz.ccz.cxxz.cppz.mz.oz.az.soz.dylibz.tbdzlib%s%sÚcygwinz.exec CsÔ| d||¡}|\}}}t||ƒ} |j| } |r>|  d|g¡|rN|| dd…<|r\|  |¡|  |¡|js~|dus~t||ƒrÐ|r”| tj   |¡¡z|  | ¡Wn,t yÎ} zt | ƒ‚WYd} ~ n d} ~ 00dS)Nú-or)Ú_fix_compile_argsrrÚextendÚappendÚforcerÚmkpathÚosÚpathÚdirnameÚspawnrr) ÚselfÚsourceÚ output_fileÚmacrosÚ include_dirsÚ extra_preargsÚextra_postargsÚ fixed_argsÚignoreÚpp_optsZpp_argsÚmsg©r0ú:/usr/local/src/Python-3.9.6/Lib/distutils/unixccompiler.pyÚ preprocessUs$      zUnixCCompiler.preprocessc Csr|j}tjdkr t |||¡}z | |||d|g|¡Wn,tyl}zt|ƒ‚WYd}~n d}~00dS)Nr r)rÚsysÚplatformÚ _osx_supportÚcompiler_fixupr$rr) r%ÚobjÚsrcÚextÚcc_argsr+r.rr/r0r0r1Ú_compileos ÿÿ zUnixCCompiler._compilerc Cs´| ||¡\}}|j||d}| ||¡r¤| tj |¡¡| |j|g||j ¡|j r°z| |j |g¡Wq°t y }zt |ƒ‚WYd}~q°d}~00n t  d|¡dS)N)Ú output_dirúskipping %s (up-to-date))Ú_fix_object_argsÚlibrary_filenameÚ _need_linkr r!r"r#r$rÚobjectsrrr r Údebug)r%rAÚoutput_libnamer<rBÚ target_langÚoutput_filenamer/r0r0r1Úcreate_static_libzs$ ÿ ÿþþ  zUnixCCompiler.create_static_libc CsÜ| ||¡\}}| |||¡}|\}}}t||||ƒ}t|ttdƒfƒsPtdƒ‚|durftj  ||¡}|  ||¡rÌ||j |d|g}| rœdg|dd…<| r¬| |dd…<| rº|  | ¡|  tj |¡¡zÎ|tjkrè|jdd…}n|jdd…}| dkrr|jrrd}tj |d¡dkr@d}d||vr@|d7}q&tj ||¡d kr\d}nd}|j||||<tjd krŠt ||¡}| ||¡Wn.tyÈ}zt|ƒ‚WYd}~n d}~00n t d |¡dS) Nz%'output_dir' must be a string or Nonerz-grzc++Úenvéú=Z ld_so_aixr r=)r>Ú _fix_lib_argsrÚ isinstanceÚstrÚtypeÚ TypeErrorr!r"Újoinr@rArr r#rÚ EXECUTABLErrrÚbasenamer3r4r5r6r$rr r rB)r%Ú target_descrArEr<Ú librariesÚ library_dirsÚruntime_library_dirsÚexport_symbolsrBr*r+Ú build_temprDr,Úlib_optsZld_argsZlinkerÚiÚoffsetr/r0r0r1Úlink”sZÿ ÿÿÿ       zUnixCCompiler.linkcCsd|S)Nú-Lr0)r%Údirr0r0r1Úlibrary_dir_optionÖsz UnixCCompiler.library_dir_optioncCsd|vpd|vS)NÚgcczg++r0)r%Z compiler_namer0r0r1Ú_is_gccÙszUnixCCompiler._is_gcccCs°tj t d¡¡}tjdd…dkr,d|Stjdd…dkrFd|Stjdd…d krz| |¡rnd d|gSd d|gS| |¡r¤t d ¡d kršd|Sd|Snd|SdS)NÚCCrr r\éÚfreebsdz -Wl,-rpath=ézhp-uxz-Wl,+sz+sÚGNULDÚyesz-Wl,--enable-new-dtags,-Rz-Wl,-Rz-R)r!r"rQrÚget_config_varr3r4r`)r%r]rr0r0r1Úruntime_library_dir_optionÜs     z(UnixCCompiler.runtime_library_dir_optioncCsd|S)Nz-lr0)r%Úlibr0r0r1Úlibrary_optionszUnixCCompiler.library_optioncCs¨|j|dd}|j|dd}|j|dd}|j|dd}tjdkr|t d¡}t d|¡} | durrt t d ¡¡} n |   d ¡} |D] } t j   | |¡} t j   | |¡} t j   | |¡}t j   | |¡}tjdkrL|   d ¡sì|   d ¡rL|   d ¡sLt j   | | d d…|¡} t j   | | d d…|¡} t j   | | d d…|¡}t j   | | d d…|¡}t j  | ¡rb| St j  |¡rx|St j  | ¡rŽ| St j  |¡r€|Sq€dS)NÚshared)Úlib_typeÚdylibÚ xcode_stubÚstaticr ÚCFLAGSz-isysroot\s*(\S+)rarHz/System/z/usr/z /usr/local/)r?r3r4rrgÚreÚsearchr5Ú_default_sysrootÚgroupr!r"rOÚ startswithÚexists)r%ÚdirsrirBZshared_fZdylib_fZ xcode_stub_fZstatic_fÚcflagsÚmÚsysrootr]rkrmrornr0r0r1Úfind_library_file sF      ÿþþ  zUnixCCompiler.find_library_file)NNNNN)NrN) NNNNNrNNNN)r)Ú__name__Ú __module__Ú __qualname__Ú compiler_typeÚ executablesr3r4Úsrc_extensionsÚ obj_extensionÚstatic_lib_extensionÚshared_lib_extensionZdylib_lib_extensionZxcode_stub_lib_extensionÚstatic_lib_formatÚshared_lib_formatZdylib_lib_formatZxcode_stub_lib_formatÚ exe_extensionr2r;rFr[r^r`rhrjr{r0r0r0r1r -sLù    ÿ  ÿ ü B*r )Ú__doc__r!r3rqÚ distutilsrÚdistutils.dep_utilrÚdistutils.ccompilerrrrÚdistutils.errorsrrr r r r4r5r r0r0r0r1Ús