m ӔAc@sdZdZdkZdkZdkZdkZdkTdklZdk Tdk l Z l Z dk lZdklZdklZeid Zd Zd efd YZdS( sdistutils.command.build_ext Implements the Distutils 'build_ext' command, for building extension modules (currently limited to C extensions, should accommodate C++ extensions ASAP).s5$Id: build_ext.py 37828 2004-11-10 22:23:15Z loewis $N(t*(sCommand(scustomize_compilersget_python_version(s newer_group(s Extension(slogs3^[a-zA-Z_][a-zA-Z_0-9]*(\.[a-zA-Z_][a-zA-Z_0-9]*)*$cCsdkl}|dS(N(sshow_compilers(tdistutils.ccompilertshow_compilers(R((tA/mirror/zmath/src/Python-2.4.4/Lib/distutils/command/build_ext.pyRs t build_extcBstZdZdeiZdAdBd d d d fd ddefdCdDdEdddefdFdGdHdIdJdKdLdMgZd d"d%d+gZd1dd2e fgZ d3Z d4Z d5Z d6Zd7Zd8Zd9Zd:Zd;Zd<Zd=Zd>Zd?Zd@ZRS(NNs8build C/C++ extensions (compile/link to build directory)s (separated by '%s')s build-lib=tbs(directory for compiled extension moduless build-temp=tts1directory for temporary files (build by-products)tinplacetis=ignore build-lib and put compiled extensions into the source s,directory alongside your pure Python moduless include-dirs=tIs.list of directories to search for header filessdefine=tDsC preprocessor macros to definesundef=tUs!C preprocessor macros to undefines libraries=tls!external C libraries to link withs library-dirs=tLs.directories to search for external C librariessrpath=tRs7directories to search for shared C libraries at runtimes link-objects=tOs2extra explicit link objects to include in the linktdebugtgs'compile/link with debugging informationtforcetfs2forcibly build everything (ignore file timestamps)s compiler=tcsspecify the compiler typesswig-cpps)make SWIG create C++ files (default is C)s swig-opts=s!list of SWIG command line optionssswig=spath to the SWIG executables help-compilerslist available compilerscCsd|_d|_d|_d|_d|_d|_d|_d|_ d|_ d|_ d|_ d|_ d|_d|_d|_d|_d|_d|_dS(Ni(tNonetselft extensionst build_libt build_tempRtpackaget include_dirstdefinetundeft librariest library_dirstrpatht link_objectsRRtcompilertswigtswig_cppt swig_opts(R((Rtinitialize_optionsas$                 cCs dkl}|iddddd d!|idjo|ii|_n|ii|_ |i }|i dd }|i djo|ii pg|_ nt|i tjoti|i ti|_ n|i i|||jo|i i|nt|itjo|ig|_n|idjo g|_n|idjo g|_n6t|itjoti|iti|_n|idjo g|_n6t|itjoti|iti|_ntid jo|iitiitid |iotii|id |_ntii|id |_|i itiitid|iitiitidntidjo&|iitiitidntid djptid djofti ti!tidjo3|iitiiti"ddt#dqu|iidn|i$o.ti|i$d}t&d||_$n|i'oti|i'd|_'n|i(djo g|_(n|i(id|_(dS("N(s sysconfigtbuildRRR"RRt plat_specificitnttlibstDebugtReleasetPCtPCBuildtos2tConfigitcygwintatheositlibtpythontconfigt.t,cCs |dfS(Nt1(tsymbol(R9((Rtst (s build_libs build_lib(s build_temps build_temp(scompilerscompiler(sdebugsdebug(sforcesforce()t distutilst sysconfigRtset_undefined_optionsRRt distributiont ext_packaget ext_modulesRtget_python_inct py_includetplat_py_includeRttypet StringTypetstringtsplittostpathseptappendRRR tnametpathtjointsyst exec_prefixRRtplatformtfindt executabletprefixtget_python_versionRtdefinestmapRR%(RRVRDRCR=((Rtfinalize_optionsvsl       " "&&(    c Csdkl}|ipdSn|iioC|id}|ii |i pg|i i |in|d|i d|id|id|i|_ t|i |idj o|i i|in|idj o1x.|iD]\}}|i i||qWn|idj o(x%|iD]}|i i|q1Wn|idj o|i i|in|i dj o|i i|i n|idj o|i i|in|i dj o|i i!|i n|i"dS(N(s new_compilert build_clibR"tverbosetdry_runR(#Rt new_compilerRRR?thas_c_librariestget_finalized_commandRYRtextendtget_library_namesRRKR"RZR[Rtcustomize_compilerRRtset_include_dirsRRLtvaluet define_macroRtmacrotundefine_macrot set_librariestset_library_dirsR tset_runtime_library_dirsR!tset_link_objectstbuild_extensions(RRLReRcRYR\((Rtruns>        c Csft|tj o tdnx?tt|D]+}||} t| t oq3n| \}}t i d|t| tj o t| djo tdnt|tjo ti|p tdnt|tj o tdnt ||d} x>dD]6}|i|}|dj ot| ||qqW|id| _|idot i dn|id}|og| _g| _x|D]}t|tjo!dt|jo djnp tdnt|djo| ii|dqt|djo| ii|qqWn| |||i|ig}x!|iD]}|i|iq W|S(N(RRRt filenamesRwR_Rm(RRwR((Rtget_source_filesrs  cCsh|i|ig}xK|iD]@}|i|i}|it i i |i |i |q W|S(N(RRRtoutputsRwtget_ext_fullnameRLtfullnameRKRIRMRNRtget_ext_filename(RRRRw((Rt get_outputs}s cCs5|i|ix|iD]}|i|qWdS(N(RRRRwtbuild_extension(RRw((RRks cCs|i}|djpt|ttfjotddd|int|}|i |i}|i out i|d} t i| dd!d} | d}|id}|i| }tii||i|} n"tii|i|i|} ||i}|ipt|| dpti d |idSnti!d |i|i"||}|i#pg} |i%}x!|i'D]}|i)|fqW|i*i+|d |i,d |d |i-d|i d| d|i}||_/|i0o|i1|i0n|i2pg} |i3p|i*i4|} |i*i5|| d|i6|d|i7d|i8d| d|i9|d|i d|i,d| dS(Ns*in 'ext_modules' option (extension '%s'), s&'sources' must be present and must be sa list of source filenamesR6iitbuild_pytnewers$skipping '%s' extension (up-to-date)sbuilding '%s' extensiont output_dirRrRRtextra_postargstdependsRRRtexport_symbolsRt target_lang(:RwRmRRERsR~RtRLtlistRRRRRGRHtmodpathRNRtbaseR^Rtget_package_dirt package_dirRIRMRt ext_filenameRRRt newer_groupR|Rtinfot swig_sourcesRot extra_argsRRrRRRKR"tcompileRRtobjectst_built_objectsRnR_Rptlanguagetdetect_languagetlink_shared_objectt get_librariesRRtget_export_symbols(RRwRmRRRRRrRRRRRRRR((RRs^ &                 cCsg} g}h} |iotidn|ipd|ijo d} nd} xt|D]l}t i i |\} }|djo4| i| d| |i|| d| |WnxE|D]=}| |} tid || |i|d | |gq`W| S( sWalk the list of source files in 'sources', looking for SWIG interface (.i) files. Run SWIG on all that are found, and return a modified 'sources' list with SWIG source files replaced by the generated C (or C++) files. s/--swig-cpp is deprecated - use --swig-opts=-c++s-c++s.cpps.cs.it_wrapis-pythonsswigging %s to %ss-oN(t new_sourcesRt swig_targetsRR$R|R}R%t target_extRmtsourceRIRMtsplitextRRwRKR#t find_swigtswig_cmdR_t extensiontottargetRtspawn(RRmRR#RRRRRwRRRRR((RRsD         cCstidjodSntidjoMxrd D]:}tiid|d}tii|o|Sq/q/WdSn)tid jodSntd tid S( sReturn the name of the SWIG executable. On Unix, this is just "swig" -- it should be in the PATH. Tries a bit harder on Windows. tposixR#R)s1.3s1.2s1.1s c:\swig%ssswig.exeR/s>I don't know how to find (much less run) SWIG on platform '%s'N(s1.3s1.2s1.1(RIRLtversRMRNtfntisfiletDistutilsPlatformError(RRR((RR2s cCs+|idjo|Sn|id|SdS(NR6(RRRRz(RRz((RRTscCsdkl}ti|d}tidjo*|t|dd |t|d