a ZÚß^.:c@spdZddlZddlmZmZmZmZmZddlm Z m Z ddl m Z ddl mZddlmZGdd „d e ƒZdS) zƒdistutils.bcppcompiler Contains BorlandCCompiler, an implementation of the abstract CCompiler class for the Borland C++ compiler. éN)ÚDistutilsExecErrorÚ CompileErrorÚLibErrorÚ LinkErrorÚUnknownFileError)Ú CCompilerÚgen_preprocess_options)Ú write_file)Únewer)Úlogc @sŒeZdZdZdZiZdgZgd¢ZeeZdZ dZ dZ dZ Z d Zdd d „Zddd„Zddd„Zddd„Zddd„Zd dd„Zd!dd„Zd S)"Ú BCPPCompilerzConcrete class that implements an interface to the Borland C/C++ compiler, as defined by the CCompiler abstract class. Zbcppz.c)z.ccz.cppz.cxxz.objz.libz.dllz%s%sz.exercCsnt ||||¡d|_d|_d|_d|_gd¢|_gd¢|_gd¢|_gd¢|_ g|_ gd¢|_ gd¢|_ dS) Nz bcc32.exez ilink32.exeztlib.exe)ú/tWMz/O2ú/qú/g0)r z/Odr r)z/Tpdú/Gnr ú/x)rr r)rr rz/r) rÚ__init__ÚccÚlinkerÚlibZpreprocess_optionsÚcompile_optionsÚcompile_options_debugÚldflags_sharedÚldflags_shared_debugZldflags_staticÚ ldflags_exeÚldflags_exe_debug)ÚselfZverboseZdry_runÚforce©rú./usr/lib64/python3.9/distutils/bcppcompiler.pyr5s     zBCPPCompiler.__init__Nc  Cs˜| ||||||¡\}} }} } |p$g} |  d¡|rB|  |j¡n |  |j¡| D]>} z| | \}}Wnty~YqRYn0tj |¡}tj | ¡} |  tj  | ¡¡|dkr´qR|dkrz|  dd| |g¡WqRt y}zt |ƒ‚WYd}~qRd}~00qR||jvrd}n||jvr*d}nd}d| }z,|  |jg| | ||g||g¡WqRt y}zt |ƒ‚WYd}~qRd}~00qR| S) Nz-cú.resú.rcZbrcc32z-foÚz-Pú-o)Z_setup_compileÚappendÚextendrrZKeyErrorÚ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_optsZobjZsrcÚextÚmsgZ input_optZ output_optrrrÚcompileQsT ÿÿ           ÿþþ  zBCPPCompiler.compilec Cs| ||¡\}}|j||d}| ||¡r€|dg|}|r:z| |jg|¡WqŒty|}zt|ƒ‚WYd}~qŒd}~00n 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_argsr6rrrÚcreate_static_lib’s ÿ   zBCPPCompiler.create_static_libc Csê| ||¡\}}| |||¡\}}}|r8t dt|ƒ¡|durNtj ||¡}| ||¡rÚ|t j krŽd}| r~|j dd…}q´|j dd…}n&d}| r¦|j dd…}n|jdd…}|durÂ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}| ||| ¡}|dur| |¡n | |¡qò| d¡| d¡| d |g¡| d ¡| |¡| rp| |dd…<| r€| | ¡| tj |¡¡z| |jg|¡Wn.tyÖ}zt|ƒ‚WYd}~n d}~00n 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,z,,Zimport32Zcw32mtr8) r9Z _fix_lib_argsr ZwarnZstrr%r&Újoinr;rZ EXECUTABLErrrrZsplitÚsplitextr)r#ZexecuterZmapr'Únormcaser$Úfind_library_filer(r*rrrr0) rZ target_descr3r=r-Z librariesZ library_dirsZruntime_library_dirsZexport_symbolsr0r1r2Z build_tempr<Z startup_objZld_argsZdef_fileZheadZtailZmodnamer5Ztemp_dirZcontentsZsymZobjects2Z resourcesZfileÚbaseZlrÚlibfiler6rrrÚ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&r?r:Zexists) rZdirsrr0ZdlibZ try_namesZdirZnamerDrrrrB4s   zBCPPCompiler.find_library_filer!cCsÆ|dur d}g}|D]¬}tj tj |¡¡\}}||jddgvrRtd||fƒ‚|rbtj |¡}|dkr„| tj |||¡¡q|dkr¦| tj ||d¡¡q| tj |||j ¡¡q|S)Nr!r rz"unknown file type '%s' (from '%s')) r%r&r@rAÚsrc_extensionsrZbasenamer#r?Ú obj_extension)rZsource_filenamesZ strip_dirr-Z obj_namesZsrc_namerCr5rrrÚobject_filenamesNs$ ÿ  ÿzBCPPCompiler.object_filenamesc CsÜ| d||¡\}}}t||ƒ}dg|} |dur>|  d|¡|rN|| dd…<|r\|  |¡|  |¡|js~|dus~t||ƒrØ|r”| tj  |¡¡z|  | ¡Wn4t yÖ} zt | ƒt | ƒ‚WYd} ~ n d} ~ 00dS)Nz cpp32.exer"r)Z_fix_compile_argsrr#r$rr r(r%r&r)r*rZprintr) rZsourceZ output_filer.r/r1r2Z_r4Zpp_argsr6rrrÚ preprocessis& ÿ     zBCPPCompiler.preprocess)rrr)NNNrNNN)NrN) NNNNNrNNNN)r)rr!)NNNNN)Z__name__Z __module__Z __qualname__Ú__doc__Z compiler_typeZ executablesr+r,rFrGZstatic_lib_extensionZshared_lib_extensionZstatic_lib_formatZshared_lib_formatZ exe_extensionrr7r>rErBrHrIrrrrr sXý þ Dû ó  ý úr )rJr%Zdistutils.errorsrrrrrZdistutils.ccompilerrrZdistutils.file_utilrZdistutils.dep_utilr Z distutilsr r rrrrZs