o ?Og.:ã@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 Z dd d „Z ddd„Z ddd„Z ddd„Zddd„Z d dd„Z d!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/Odrr)z/Tpdú/Gnrú/x)rrr)rrrz/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ú=/opt/alt/python310/lib64/python3.10/distutils/bcppcompiler.pyr5s     zBCPPCompiler.__init__Nc  Csn| ||||||¡\}} }} } |pg} |  d¡|r!|  |j¡n|  |j¡| D]‹} z| | \}}Wn ty<Yq)wtj |¡}tj | ¡} |  tj  | ¡¡|dkrWq)|dkrxz |  dd| |g¡Wnt yv}zt |ƒ‚d}~wwq)||jvr€d}n ||jvrˆd}nd}d| }z|  |jg| | ||g||g¡Wq)t y´}zt |ƒ‚d}~ww| 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 ÚcompileQs^ ÿ ÿ   ÿ  €ÿ  ÿþ þ€ÿzBCPPCompiler.compilec Cs†| ||¡\}}|j||d}| ||¡r;|dg|}|r z | |jg|¡WdSty:}zt|ƒ‚d}~wwt d|¡dS)N)r0z/uúskipping %s (up-to-date)) Ú_fix_object_argsÚlibrary_filenameÚ _need_linkr-rrrr r3) rr6Zoutput_libnamer0r3Ú target_langÚoutput_filenameZlib_argsr;rrr Úcreate_static_lib’s ÿ  €ÿzBCPPCompiler.create_static_libc CsÒ| ||¡\}}| |||¡\}}}|rt dt|ƒ¡|dur'tj ||¡}| ||¡ra|t j krGd}| r?|j dd…}n|j dd…}nd}| rS|j dd…}n|jdd…}|durad}n?tj |¡\}}tj |¡\}}tj |d¡}tj |d|¡}dg}|pˆgD] }| d||f¡q‰| t||fd |¡ttjj|ƒ}|g}g}|D]}tj tj |¡¡\}}|d krÆ| |¡q®| |¡q®|D] }| d tj |¡¡qÎ| d ¡| |¡| d |g¡| d¡|D]}| ||| ¡}|dur| |¡qô| |¡qô| d¡| d¡| d |g¡| d ¡| |¡| r2| |dd…<| r:| | ¡| tj |¡¡z | |jg|¡WdSty`}zt|ƒ‚d}~wwt d|¡dS)Nz7I don't know what to do with 'runtime_library_dirs': %sZc0w32Zc0d32r#rz%s.defZEXPORTSz %s=_%sz writing %sr!z/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-rrrr3) rZ target_descr6rBr0Z librariesZ library_dirsZruntime_library_dirsZexport_symbolsr3r4r5Z build_temprAZ startup_objZld_argsZdef_fileÚheadÚtailÚmodnamer:Ztemp_dirÚcontentsZsymZobjects2Z resourcesÚfileÚbaseÚlrÚlibfiler;rrr Úlink«s† ÿÿ   ÿ              €ÿzBCPPCompiler.linkc Csr|r|d}|d|d||f}n|d|f}|D]}|D]}tj || |¡¡}tj |¡r5|SqqdS)NZ_dZ_bcpp)r(r)rGr?Úexists) rÚdirsrr3ZdlibZ try_namesÚdirÚnamerTrrr rL4s    ÿþzBCPPCompiler.find_library_filer#cCsÆ|durd}g}|D]V}tj tj |¡¡\}}||jddgvr)td||fƒ‚|r1tj |¡}|dkrB| tj |||¡¡q |dkrS| tj ||d¡¡q | tj |||j ¡¡q |S)Nr#r"r!z"unknown file type '%s' (from '%s')) r(r)rIrKÚsrc_extensionsrÚbasenamer%rGÚ obj_extension)rZsource_filenamesZ strip_dirr0Z obj_namesZsrc_namerRr:rrr Úobject_filenamesNs$ ÿ  ÿzBCPPCompiler.object_filenamesc CsÒ| d||¡\}}}t||ƒ}dg|} |dur|  d|¡|r'|| dd…<|r.|  |¡|  |¡|js?|dus?t||ƒrg|rJ| tj  |¡¡z|  | ¡WdSt yf} zt | ƒt | ƒ‚d} ~ wwdS)Nz cpp32.exer$r)Z_fix_compile_argsrr%r&rr r+r(r)r,r-rÚprintr) rÚsourceZ output_filer1r2r4r5Ú_r7Zpp_argsr;rrr Ú preprocessis, ÿ     €þûzBCPPCompiler.preprocess)rrr)NNNrNNN)NrN) NNNNNrNNNN)r)rr#)NNNNN)Ú__name__Ú __module__Ú __qualname__Ú__doc__Z compiler_typeZ executablesr.r/rZr\Zstatic_lib_extensionZshared_lib_extensionZstatic_lib_formatZshared_lib_formatZ exe_extensionrr<rCrUrLr]rarrrr r sZ ý þD û ó  ýúr )rer(Zdistutils.errorsrrrrrZdistutils.ccompilerrrZdistutils.file_utilr Zdistutils.dep_utilr Z distutilsr r rrrr Ús