a „oe‚9ã@s„dZddlZddlZddlmZmZmZmZmZddl m Z m Z ddl m Z ddlmZddlmZe d e¡Gd d „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)Úlogz˜bcppcompiler is deprecated and slated to be removed in the future. Please discontinue use or file an issue with pypa/distutils describing your use case.c s”eZdZdZdZiZdgZgd¢ZeeZdZ dZ dZ dZ Z d Zd‡fd d „ Zddd„Zddd„Zddd„Zddd„Zd dd„Zd!dd„Z‡ZS)"Ú 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.exercsntƒ |||¡d|_d|_d|_d|_gd¢|_gd¢|_gd¢|_gd¢|_ g|_ gd¢|_ gd¢|_ dS) Nz bcc32.exez ilink32.exeztlib.exe)ú/tWMz/O2ú/qú/g0)rz/Odrr)z/Tpdú/Gnrú/x)rrr)rrrz/r) ÚsuperÚ__init__ÚccÚlinkerÚlibZpreprocess_optionsÚcompile_optionsÚcompile_options_debugÚldflags_sharedÚldflags_shared_debugZldflags_staticÚ ldflags_exeÚldflags_exe_debug)ÚselfÚverboseÚdry_runÚforce©Ú __class__©úCC:\Program Files\Certbot\pkgs\setuptools\_distutils\bcppcompiler.pyrBs     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Ú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_optsÚbuildZ compile_optsÚobjÚsrcÚextÚmsgZ input_optZ output_optr$r$r%ÚcompileYs^  ÿ          ÿþýüûÿ zBCPPCompiler.compilec Cs| ||¡\}}|j||d}| ||¡r€|dg|}|r:z| |jg|¡WqŒty|}zt|ƒ‚WYd}~qŒd}~00n t d|¡dS)N)r5z/uúskipping %s (up-to-date)) Ú_fix_object_argsÚlibrary_filenameÚ _need_linkr2rrrr r8) rr;Zoutput_libnamer5r8Ú target_langÚoutput_filenameZlib_argsrAr$r$r%Ú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 ||¡¡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 |g¡| d ¡| |¡| rf| |dd…<| rv| | ¡| 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 {}=_{}z writing %sr&z/L%sz/L.ú,z,,)Zimport32Zcw32mtrC)!rDZ _fix_lib_argsr ZwarningÚstrr-r.ÚjoinrFrZ EXECUTABLErrrrÚsplitÚsplitextr1r*ÚformatZexecuter Úmapr/Únormcaser+Úfind_library_filer0r2rrrr8) rZ target_descr;rHr5Z librariesZ library_dirsZruntime_library_dirsZexport_symbolsr8r9r:Z build_temprGZ startup_objZld_argsZdef_fileÚheadÚtailÚmodnamer@Ztemp_dirÚcontentsZsymZobjects2Z resourcesÚfileÚbaseZellrÚlibfilerAr$r$r%Ú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.rLrEÚexists) rÚdirsrr8ZdlibZ try_namesÚdirÚnamerYr$r$r%rR>s   zBCPPCompiler.find_library_filer(cCsÆ|dur d}g}|D]¬}tj tj |¡¡\}}||jddgvrRtd ||¡ƒ‚|rbtj |¡}|dkr„| tj  |||¡¡q|dkr¦| tj  ||d¡¡q| tj  |||j ¡¡q|S)Nr(r'r&z"unknown file type '{}' (from '{}')) r-r.rNrQÚsrc_extensionsrrOÚbasenamer*rLÚ obj_extension)rZsource_filenamesZ strip_dirr5Z obj_namesZsrc_namerXr@r$r$r%Úobject_filenamesXs" ÿ 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_argsr r*r+r!r r0r-r.r1r2rÚprintr) rÚsourceZ output_filer6r7r9r:Ú_r<Zpp_argsrAr$r$r%Ú preprocessqs$      zBCPPCompiler.preprocess)rrr)NNNrNNN)NrN) NNNNNrNNNN)r)rr()NNNNN)Ú__name__Ú __module__Ú __qualname__Ú__doc__Z compiler_typeZ executablesr3r4r_raZstatic_lib_extensionZshared_lib_extensionZstatic_lib_formatZshared_lib_formatZ exe_extensionrrBrIrZrRrbrfÚ __classcell__r$r$r"r%r 'sT÷ Mÿ ò   ùr )rjr-ÚwarningsÚerrorsrrrrrZ ccompilerrr Z file_utilr Z _modifiedr Z_logr ÚwarnÚDeprecationWarningr r$r$r$r%Ús   ü