qLc@sdZdZddlZddlZddlZddlZddlZddlZddl Zddl Zddl Zddl ZgZ ejjjZejjjZejjjZejjjZejjjZejjiddZdddd d d d d dddddddddddgZdgZddgZdddgZxeD]ZejeeqfWxeD]ZejeeqWx.eD]&ZejeeejeeqWde fd YZ!d!Z"d"Z#d#Z$d$Z%d%Z&d&Z'd'Z(d(Z)d)Z*d*Z+d+Z,d,e fd-YZ-d.e fd/YZ.d0Z/d1Z0d2Z1d3Z2dS(4sSCons.Tool SCons tool selection. This looks for modules that define a callable object that can modify a construction environment as appropriate for a given tool (or tool chain). Note that because this subsystem just *selects* a callable that can modify a construction environment, it's possible for people to define their own "tool specification" in an arbitrary callable function. No one needs to use or tie in to this subsystem in order to roll their own tool definition. s@src/engine/SCons/Tool/__init__.py 5023 2010/06/14 22:05:46 sconsiNtnametSourceFileScanners.cs.Cs.cxxs.cpps.c++s.ccs.hs.Hs.hxxs.hpps.hhs.Fs.fpps.FPPs.ms.mms.Ss.spps.SPPs.ds.idls.IDLs.texs.ltxs.latextToolcBs/eZgdZdZdZdZRS(cKse||_|t|_||_|j}|j|_|j|_t|dra|j|_ndS(Ntoptions( RtDefaultToolpathttoolpathtinit_kwt _tool_moduletgeneratetexiststhasattrR(tselfRRtkwtmodule((sc/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/__init__.pyt__init__Xs      c Cstj}|jtjt_zyYtj|j|j\}}}ztj|j|||SWd|rv|jnXWntk r,}t |d|jkrt j j |nyddl }Wntk rq-XxN|jD]?}y#|j|}|j|jSWqtk r$}qXqWnXWd|t_Xd|j} ytj| SWntk ryPtjdj} ygtj|j| \}}}tj| |||} tt j|j| |r|jn| SWntk r}t |d|jkr!t j j |nyVddl }|jtjdjd}|j| } tt j|j| | SWqtk r}d|j|f} t j j | qXnXWqtk r}d|j|f} t j j | qXnXdS(NsNo module named %sis SCons.Tool.s SCons.ToolisNo tool named '%s': %s(tsystpathRtimpt find_moduleRt load_moduletcloset ImportErrortstrtSConstErrorstEnvironmentErrort zipimportt zipimportertmodulestKeyErrort__path__tsetattrR( R t oldpythonpathtfileRtdescteRtaPathtimportert full_nametsmpathR tm((sc/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/__init__.pyRdsf !      cOs|jdk rL|dk r@|}|jj}|j|qL|j}n|jd|jgt|drddl}d|krddlm }|j j d||ds $LIBEMITTERR?s $LIBPREFIXR@s $LIBSUFFIXRAs $OBJSUFFIXRBt StaticObjecttLibrary(RRtActiontDetecttappendRF(R4t static_libt action_listt ranlib_action((sc/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/__init__.pytcreateStaticLibBuilders   cCsy|dd}Wn|tk rddl}|jj|jjg}|jjd|dddd d d d td ddd}||dds $SHLIBEMITTERR?s $SHLIBPREFIXR@s $SHLIBSUFFIXRDRAs $SHOBJSUFFIXRBt SharedObject(RRERGt SharedCheckt ShLinkActionRFRI(R4t shared_libRRT((sc/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/__init__.pytcreateSharedLibBuilders    cCsy|dd}Wn|tk rddl}|jj|jjg}|jjd|dddd d d d td ddd}||dds$LDMODULEEMITTERR?s$LDMODULEPREFIXR@s$LDMODULESUFFIXRDRAs $SHOBJSUFFIXRBRX(RRERGRYtLdModuleLinkActionRFRI(R4t ld_moduleRRT((sc/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/__init__.pytcreateLoadableModuleBuilders    cCsy|dd}Wnltk rtjjdididdddd d d gd td d}||dd<||ddR?s $OBJPREFIXR@s $OBJSUFFIXRBtCFiletCXXFiletsource_scannert single_sourceiRCRXs $SHOBJPREFIXs $SHOBJSUFFIX(RRRFR(R4t static_objt shared_obj((sc/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/__init__.pytcreateObjBuilderss0      c Csy|dd}WnWtk rktjjdidididd 6}||dd<|jddnXy|dd }WnWtk rtjjdididid d 6}||dd <|jd d nX||fS(sDThis is a utility function that creates the CFile/CXXFile Builders in an Environment if they are not there already. If they are there already, we return the existing ones. This is a separate function because soooo many Tools use this functionality. The return is a 2-tuple of (CFile, CXXFile) R;RaR=R>R@s $CFILESUFFIXt CFILESUFFIXs.cRbs$CXXFILESUFFIXt CXXFILESUFFIXs.ccN(RRRFR,t SetDefault(R4tc_filetcxx_file((sc/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/__init__.pytcreateCFileBuildersEs"   c Csy|dd}Wnvtk rtjjj}tjjdd}tjjd|dddd d d d |j}||ddRAs $JAVASUFFIXRBtJavaFileRzRp( RRRqRrRsRPRFRtR{(R4tjava_class_fileRvt javac_com((sc/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/__init__.pytCreateJavaClassFileBuilders    c Csy|dd}Wnstk rtjjj}tjjdd}tjjd|did|jd|j}||ddRzRp(RRRqRrRsRPRFtDir(R4tjava_class_dirRvR((sc/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/__init__.pytCreateJavaClassDirBuilders   c Csjy|dd}WnQtk retjjdidididd6}||ddR@s $JAVASUFFIXs.javat JAVASUFFIX(RRRFR,(R4t java_file((sc/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/__init__.pytCreateJavaFileBuilders tToolInitializerMethodcBs)eZdZdZdZdZRS(s This is added to a construction environment in place of a method(s) normally called for a Builder (env.Object, env.StaticObject, etc.). When called, it has its associated ToolInitializer object search the specified list of tools and apply the first one that exists to the construction environment. It then calls whatever builder was (presumably) added to the construction environment in place of this particular instance. cCs||_||_dS(s Note: we store the tool name as __name__ so it can be used by the class that attaches this to a construction environment. N(R9t initializer(R RR((sc/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/__init__.pyRs cCsXt||j}|jj|t||j}||krDdS|jj||S(s Returns the appropriate real Builder for this method name after having the associated ToolInitializer object apply the appropriate Tool module. N(tgetattrR9Rt apply_toolsR,tremove_methods(R R4tbuilder((sc/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/__init__.pyt get_builders cOs2|j|}|dkr%ggfS|||S(s N(RR,(R R4R+R R((sc/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/__init__.pyR7s  (R9R:t__doc__RRR7(((sc/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/__init__.pyRs   tToolInitializercBs)eZdZdZdZdZRS(s A class for delayed initialization of Tools modules. Instances of this class associate a list of Tool modules with a list of Builder method names that will be added by those Tool modules. As part of instantiating this object for a particular construction environment, we also add the appropriate ToolInitializerMethod objects for the various Builder methods that we want to use to delay Tool searches until necessary. cCstjj|s|g}ntjj|s<|g}n||_||_||_i|_x7|D]/}t||}||j|<|j|qgWdS(N( RtUtiltis_ListR4ttoolstnamestmethodsRt AddMethod(R R4RRRtmethod((sc/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/__init__.pyRs        cCs+x$|jjD]}|j|qWdS(s Removes the methods that were added by the tool initialization so we no longer copy and re-bind them when the construction environment gets cloned. N(Rtvaluest RemoveMethod(R R4R((sc/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/__init__.pyRscCsJxC|jD]8}tjj|}|j|r |j|dSq WdS(s Searches the list of associated Tool modules for one that exists, and applies that to the construction environment. N(RRRR (R R4ttttool((sc/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/__init__.pyRs  (R9R:RRRR(((sc/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/__init__.pyRs   cCsIt|dgddgd}d}|j||j|dS(Ntinstallt_InternalInstallt_InternalInstallAsc_s|j||S(N(R(R R+R ((sc/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/__init__.pytInstallsc_s|j||S(N(R(R R+R ((sc/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/__init__.pyt InstallAss(RR(R4RR((sc/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/__init__.pyt Initializerss    cCs4x-|D]%}t|}|j|r|SqWdS(N(RR R,(RR4RR((sc/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/__init__.pytFindTools   cCs|d}tt||S(NcSst|j|S(N(RR (RR4((sc/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/__init__.pyt ToolExists"s(tlisttfilter(RR4R((sc/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/__init__.pyt FindAllTools!s c$Csg}t|dkrdddddg}ddd d d d d dg}dd d dddg}ddddg}dddddddg}dddg}dd g}nt|d!krddg}d d g}d dg}dg}ddg}dg}n|t|d"krnd#dg}d$d d g}d%ddg}d&dg}ddd'ddg}d(g}nt|d)krd*dg}d+d d g}d,ddg}d&dg}d-d.d/ddd'dddg }d0g}nt|d1krLd2dg}d3d d g}d4ddg}d&dg}ddd'ddg}dg}n5t|d5krd6dg}d7d d g}d8ddg}d&dg}ddd9ddg}dg}nt|d:krd;dg}d d g}ddg}d&g}ddddg}dg}nodddg}d dd d d g}ddd d dg}dddg}ddd<dddd'g}ddg}t||p|d=} | r| dkrd} d} d} d} d}n| dYkrd} nt||p|d=} t||p|d=} t||p*|d=} t||pC|d=} t||p\|d=}t|d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXg|}| | | | | |g|}g|D]}|r|^qS(ZNtwin32tmslinktgnulinktilinktlinkloctilink32tmsvctmingwtgcctintelcticlticctcctbcc32sg++sc++tmasmtnasmtgast386asmtgfortrantg77tifltcvftf95tf90tfortrantmslibtarttlibtmsvstmidltos2tirixtsgilinktsgiccssgic++tastf77tsgiartsunostsunlinktsunccssunc++tsunf95tsunf90tsunf77tsunarthpuxthplinkthpccshpc++taixtaixlinktaixccsaixc++taixf77tdarwint applelinktifortitdmdt filesystemtm4twixtlextyacctrpcgentswigtjartjavactjavahtrmictdvipdftdvipstgsttextlatextpdflatextpdftexttartziptrpmt BitKeepertCVStPerforcetRCStSCCS(RRR(RRR,R(tplatformR4tother_plat_toolstlinkerst c_compilerst cxx_compilerst assemblerstfortran_compilerstarst c_compilert cxx_compilertlinkert assemblertfortran_compilerRt other_toolsRtx((sc/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/__init__.pyt tool_list&s                                    (3Rt __revision__RRt SCons.BuilderRt SCons.Errorst SCons.Node.FSt SCons.ScannertSCons.Scanner.CtSCons.Scanner.DtSCons.Scanner.LaTeXtSCons.Scanner.ProgRtScannertCtCScannertDtDScannertLaTeXt LaTeXScannertPDFLaTeXScannertProgRItBaseRt CSuffixest DSuffixest IDLSuffixest LaTeXSuffixesR@t add_scannertobjectRRKRVR\R`RgRmRxR~RRRRRRRRR (((sc/home/als/proj/qrscanner/ext/qrscanner/zxing/scons/scons-local-2.0.0.final.0/SCons/Tool/__init__.pytsf                e     ) %    03