U e5dW:ã@stddlZddlmZmZmZmZmZmZddlm Z m Z m Z ddl m Z ddlmZddlmZGdd„de ƒZdS) éN)ÚDistutilsExecErrorÚDistutilsPlatformErrorÚ CompileErrorÚLibErrorÚ LinkErrorÚUnknownFileError)Ú CCompilerÚgen_preprocess_optionsÚgen_lib_options)Ú write_file)Únewer)Úlogc @sŠeZdZdZiZdgZdddgZeeZdZdZ dZ d Z Z d Z dd d „Zddd„Zddd„Zddd„Zd dd„Zd!dd„Zd"dd„ZdS)#Ú BCPPCompilerZbcppz.cz.ccz.cppz.cxxz.objz.libz.dllz%s%sz.exercCs„t ||||¡d|_d|_d|_d|_ddddg|_ddddg|_d d dd g|_d d dd g|_ g|_ d dd g|_ d dd d g|_ dS) Nz bcc32.exez ilink32.exeztlib.exez/tWMz/O2z/qz/g0z/Odz/Tpdz/Gnz/xz/r) rÚ__init__ÚccÚlinkerÚlibZpreprocess_optionsÚcompile_optionsÚcompile_options_debugÚldflags_sharedÚldflags_shared_debugZldflags_staticÚ ldflags_exeÚldflags_exe_debug)ÚselfÚverboseZdry_runÚforce©rú./usr/lib64/python3.8/distutils/bcppcompiler.pyr5s zBCPPCompiler.__init__Nc  Cs–| ||||||¡\}} }} } |p$g} |  d¡|rB|  |j¡n |  |j¡| D]<} z| | \}}Wntk r€YqRYnXtj |¡}tj | ¡} |  tj  | ¡¡|dkr¶qR|dkrz|  dd| |g¡WqRt k r}z t |ƒ‚W5d}~XYqRXqR||jkrd}n||jkr*d}nd}d| }z,|  |jg| | ||g||g¡WqRt k rŽ}z t |ƒ‚W5d}~XYqRXqR| S) Nz-cú.resú.rcZbrcc32z-foÚz-Pú-o)Z_setup_compileÚappendÚextendrrÚKeyErrorÚosÚpathÚnormpathÚmkpathÚdirnameÚspawnrrÚ _c_extensionsÚ_cpp_extensionsr)rZsourcesÚ output_dirÚmacrosÚ include_dirsÚdebugÚ extra_preargsÚextra_postargsZdependsÚobjectsÚpp_optsZbuildZ compile_optsÚobjÚsrcÚextÚmsgZ input_optZ output_optrrrÚcompileQsV ÿÿ          ÿþþ zBCPPCompiler.compilec CsŽ| ||¡\}}|j||d}| ||¡r~|dg|}|r:z| |jg|¡WqŠtk rz}z t|ƒ‚W5d}~XYqŠXn t d|¡dS)N)r-z/uúskipping %s (up-to-date)) Ú_fix_object_argsÚlibrary_filenameÚ _need_linkr*rrrr r0) rr3Zoutput_libnamer-r0Ú target_langÚoutput_filenameZlib_argsr8rrrÚcreate_static_lib’s ÿ  zBCPPCompiler.create_static_libc Csè| ||¡\}}| |||¡\}}}|r8t dt|ƒ¡|dk rNtj ||¡}| ||¡rØ|t j krŽd}| r~|j dd…}q´|j dd…}n&d}| r¦|j dd…}n|jdd…}|dkrÂd}n‚tj |¡\}}tj |¡\}}tj |d¡}tj |d|¡}dg}|pgD]}| d||f¡q| t||fd |¡ttjj|ƒ}|g}g}|D]>}tj tj |¡¡\}}|d kr’| |¡n | |¡q`|D]}| d tj |¡¡q¤| d ¡| |¡| d |g¡| d¡|D]4}| ||| ¡}|dkr| |¡n | |¡qò| d¡| d¡| d |g¡| d ¡| |¡| rp| |dd…<| r€| | ¡| tj |¡¡z| |jg|¡Wn,tk rÔ}z t|ƒ‚W5d}~XYnXn t d|¡dS)Nz7I don't know what to do with 'runtime_library_dirs': %sZc0w32Zc0d32r rz%s.defZEXPORTSz %s=_%sz writing %srz/L%sz/L.ú,z,,Zimport32Zcw32mtr:) r;Z _fix_lib_argsr ÚwarnÚstrr%r&Újoinr=rZ EXECUTABLErrrrÚsplitÚsplitextr)r"Zexecuter Úmapr'Únormcaser#Úfind_library_filer(r*rrrr0) rZ target_descr3r?r-Z librariesZ library_dirsZruntime_library_dirsZexport_symbolsr0r1r2Z build_tempr>Z startup_objZld_argsZdef_fileÚheadÚtailÚmodnamer7Ztemp_dirÚcontentsZsymZobjects2Z resourcesÚfileÚbaseÚlrÚlibfiler8rrrÚlink«s‚ ÿÿ  ÿ             zBCPPCompiler.linkc Csr|r"|d}|d|d||f}n |d|f}|D]:}|D]0}tj || |¡¡}tj |¡r:|Sq:q2dS)NZ_dZ_bcpp)r%r&rDr<Úexists) rÚdirsrr0ZdlibZ try_namesÚdirÚnamerQrrrrI4s   zBCPPCompiler.find_library_filer cCsÆ|dkr d}g}|D]¬}tj tj |¡¡\}}||jddgkrRtd||fƒ‚|rbtj |¡}|dkr„| tj |||¡¡q|dkr¦| tj ||d¡¡q| tj |||j ¡¡q|S)Nr rrz"unknown file type '%s' (from '%s')) r%r&rFrHÚsrc_extensionsrÚbasenamer"rDÚ obj_extension)rZsource_filenamesZ strip_dirr-Z obj_namesZsrc_namerOr7rrrÚobject_filenamesNs&ÿ  ÿzBCPPCompiler.object_filenamesc CsÚ| d||¡\}}}t||ƒ}dg|} |dk r>|  d|¡|rN|| dd…<|r\|  |¡|  |¡|js~|dks~t||ƒrÖ|r”| tj  |¡¡z|  | ¡Wn2t k rÔ} zt | ƒt | ƒ‚W5d} ~ XYnXdS)Nz cpp32.exer!r)Z_fix_compile_argsr r"r#rr r(r%r&r)r*rÚprintr) rÚsourceZ output_filer.r/r1r2Ú_r4Zpp_argsr8rrrÚ preprocessis& ÿ     zBCPPCompiler.preprocess)rrr)NNNrNNN)NrN) NNNNNrNNNN)r)rr )NNNNN)Ú__name__Ú __module__Ú __qualname__Z compiler_typeZ executablesr+r,rWrYZstatic_lib_extensionZshared_lib_extensionZstatic_lib_formatZshared_lib_formatZ exe_extensionrr9r@rRrIrZr^rrrrrs` ý þ Dû ó  ý úr)r%Zdistutils.errorsrrrrrrZdistutils.ccompilerrr r Zdistutils.file_utilr Zdistutils.dep_utilr Z distutilsr rrrrrÚs