a  ze:@sdZddlZddlZddlZddlZddlmZddlmZddl m Z m Z m Z ddl mZmZmZmZddlmZejdkrddlZGd 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) CCompilergen_preprocess_optionsgen_lib_options)DistutilsExecError CompileErrorLibError LinkError)logdarwinc @seZdZdZddgdgdgddgdgddgddZejddd krNd ged <gd Zd Zd Z dZ dZ dZ dZ ZZeZejdkrdZd'ddZddZd(ddZd)ddZddZdd Zd!d"Zd#d$Zd*d%d&ZdS)+ UnixCCompilerunixNccz-sharedarz-cr) preprocessorcompiler compiler_so compiler_cxx linker_so linker_exearchiverranlibr r)z.cz.Cz.ccz.cxxz.cppz.mz.oz.az.soz.dylibz.tbdzlib%s%scygwinz.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)Z_fix_compile_argsrrextendappendforcermkpathospathdirnamespawnrr) selfsourceZ output_fileZmacros include_dirs extra_preargsextra_postargs fixed_argsignorepp_optsZpp_argsmsgr-e/opt/bitninja-python-dojo/embedded/lib/python3.9/site-packages/setuptools/_distutils/unixccompiler.py preprocessUs$      zUnixCCompiler.preprocessc Csr|j}tjdkr t|||}z ||||d|g|Wn,tyl}zt|WYd}~n d}~00dS)Nr r)rsysplatform _osx_supportcompiler_fixupr#rr) r$objsrcextZcc_argsr(r+rr,r-r-r._compileos  zUnixCCompiler._compilerc Cs|||\}}|j||d}|||r|tj|||j|g||j |j rz||j |gWqt y}zt |WYd}~qd}~00n t d|dS)N) output_dirskipping %s (up-to-date))_fix_object_argslibrary_filename _need_linkrr r!r"r#robjectsrrr r debug)r$r=Zoutput_libnamer8r> target_langoutput_filenamer,r-r-r.create_static_libzs$    zUnixCCompiler.create_static_libc Cs|||\}}||||}|\}}}t||||}t|ttdfsPtd|durftj ||}| ||r||j |d|g}| rdg|dd<| r| |dd<| r| | | tj|z|tjkr|jdd}n|jdd}| dkrr|jrrd}tj|ddkr@d}d||vr@|d7}q&tj||d kr\d}nd}|j||||<tjd krt||}|||Wn.ty}zt|WYd}~n d}~00n td |dS) Nz%'output_dir' must be a string or Nonerz-grzc++env=Z ld_so_aixr r9)r:Z _fix_lib_argsr isinstancestrtype TypeErrorr r!joinr<r=rrr"rZ EXECUTABLErrrbasenamer0r1r2r3r#rr r r>)r$Z target_descr=r@r8 libraries library_dirsruntime_library_dirsexport_symbolsr>r'r( build_tempr?r)Zlib_optsZld_argsZlinkerioffsetr,r-r-r.linksZ        zUnixCCompiler.linkcCsd|S)N-Lr-)r$dirr-r-r.library_dir_optionsz UnixCCompiler.library_dir_optioncCsd|vpd|vS)NZgcczg++r-)r$Z compiler_namer-r-r._is_gccszUnixCCompiler._is_gcccCstjttdd}tjdddkrjddl m }m }|}|r`||ddgkr`d|Sd |Sntjdd d krd |Stjddd kr| |rdd |gSdd |gS| |rtddkrd|Sd|Snd|SdS)NCCrrr )get_macosx_target_ver split_version z -Wl,-rpath,rSZfreebsdz -Wl,-rpath=zhp-uxz-Wl,+sz+sGNULDyesz-Wl,--enable-new-dtags,-Rz-Wl,-Rz-R) r r!rJshlexsplitrget_config_varr0r1distutils.utilrXrYrV)r$rTrrXrYZmacosx_target_verr-r-r.runtime_library_dir_options$      z(UnixCCompiler.runtime_library_dir_optioncCsd|S)Nz-lr-)r$libr-r-r.library_option szUnixCCompiler.library_optioncCs|j|dd}|j|dd}|j|dd}|j|dd}tjdkrptd}td|} | durfd } n | d } |D] } tj | |} tj | |} tj | |}tj | |}tjdkr@| d s| d r@| d s@tj | | d d|} tj | | d d|} tj | | d d|}tj | | d d|}tj | rV| Stj |rl|Stj | r| Stj |rt|SqtdS)Nshared)Zlib_typedylib xcode_stubstaticr CFLAGSz-isysroot\s*(\S+)/rCz/System/z/usr/z /usr/local/) r;r0r1rraresearchgroupr r!rI startswithexists)r$dirsrdr>Zshared_fZdylib_fZ xcode_stub_fZstatic_fcflagsmZsysrootrTrfrgrirhr-r-r.find_library_file sF        zUnixCCompiler.find_library_file)NNNNN)NrN) NNNNNrNNNN)r)__name__ __module__ __qualname__ compiler_typeZ executablesr0r1Zsrc_extensionsZ obj_extensionZstatic_lib_extensionshared_lib_extensionZdylib_lib_extensionZxcode_stub_lib_extensionZstatic_lib_formatZshared_lib_formatZdylib_lib_formatZxcode_stub_lib_formatZ exe_extensionr/r7rArRrUrVrcrertr-r-r-r.r -sL       B.r )__doc__r r0rlr_ distutilsrdistutils.dep_utilrdistutils.ccompilerrrrdistutils.errorsrrr r r r1r2r r-r-r-r.s