mò =¬rCc@sdklZdkZdkZdkZdkZdkZdklZdk l Z ydk l Z Wn ej odk lZ nXdfd„ƒYZdfd „ƒYZd „Zddd „Zddd „Zddd „Zddd„Zd„ZdddddgZdS((s nested_scopesN(sutil(s namedModule(srealpath(sabspathtPlugIncBs2tZdZd„Zd„Zd„Zd„ZRS(s;I am a Python module registered in a plugins.tml file. cKsC||_||_x*|iƒD]\}}t|||ƒqWdS(N(tnametselftmoduletkwtitemstkeytvaluetsetattr(RRRRRR((tm/home/radix/Projects/Twisted/branches/releases/twisted-core-2.5.x-2329-2/Twisted.exp/twisted/python/plugin.pyt__init__s    cCstii|iƒS(sÈCheck to see if the module for this plugin has been imported yet. @rtype: C{int} @return: A true value if the module for this plugin has been loaded, false otherwise. N(tsystmodulesthas_keyRR(R((R tisLoaded"scCs t|iƒS(s{Load the module for this plugin. @rtype: C{ModuleType} @return: The module object that is loaded. N(t namedModuleRR(R((R tload+scCs:|iƒo d}nd}dt|iƒ|i|fS(Ns loadedts(RRtloadedtreprRR(RR((R t__repr__3s  (t__name__t __module__t__doc__R RRR(((R Rs   tDropIncBs)tZdZd„Zd„Zd„ZRS(s2I am a Python package containing plugins.tml. cCs||_g|_dS(N(RRtplugins(RR((R R =s cKs3tidtdƒ|iit|||ƒdS(s Register a new plug-in. s\The twisted.python.plugin system is deprecated. See twisted.plugin for the revised edition.iN( twarningstwarntDeprecationWarningRRtappendRRRR(RRRR((R tregisterAs  cCsd|i|ifS(Ns(RRR(R((R RIs(RRRR RR(((R R:s   cCsš|o/y|dƒWq?d„}|dƒq?Xn d„}|oAy|dƒWqtidƒ}|d„}|dƒqXn d„}||fS(NsLooking for plugin.tml filescCstii|dƒS(Ns (R tstdouttwritetx(R!((R tRscCsdS(N(tNone(R!((R R"Usf0.0iLcCstii||ƒdƒS(Ns (R RR tpbR!(R!R$((R R"[scCsdS(N(R#(R!((R R"^s(tdebugtprogresstutilt makeStatusBarR$(R%R&R$((R t_prepCallbacksMs     cCs!t|tiƒotidtdƒnt|tiƒotidtdƒnt||ƒ\}}t i i }t i i }g}h}h} g}ti D]:}t|tƒo$t i i|ƒo|t|ƒq¡q¡~}x5dD]-}y|i|ƒWqëtj oqëXqëWd} dt|ƒ}xÞttt|ƒƒ|ƒD]Á\}}|| ƒ|i!|ƒo|d|ƒqNn|d |ƒyt i"|ƒ} Wn@t$j o4\}}|t'i(jo|d |ƒq‚qNXg}| D]}d |jo ||qøqø~} | pqNn|dt| ƒ}xË| D]Ã} | i!| ƒo|d | ƒqHn||| d fƒ} t,||| fƒƒoHd| | <|| ƒo|i-| ƒ|d| ƒq÷|d| ƒn|d| ƒ| |} || ƒqHWqNW|dƒ|S(sFind plugin.tml files in subdirectories of paths in C{sys.path} @type debugInspection: C{None} or a callable taking one argument @param debugInspection: If not None, this is invoked with strings containing debug information about the loading process. If it is any other true value, this debug information is written to stdout (This behavior is deprecated). @type showProgress: C{None} or a callable taking one argument. @param showProgress: If not None, this is invoked with floating point values between 0 and 1 describing the progress of the loading process. If it is any other true value, this progress information is written to stdout. (This behavior is deprecated). @rtype: C{list} of C{str} @return: A list of the plugin.tml files found. snint parameter for debugInspection is deprecated, pass None or a function that takes a single argument instead.iskint parameter for showProgress is deprecated, pass None or a function that takes a single argument instead.s/usr/bins/usr/local/binf0.0f1.0s Already saw sRecursing through sPermission denied on t.sSeen %s alreadys plugins.tmlisFound sFailed s Not a module N(s/usr/bins/usr/local/bin(.t isinstancetdebugInspectionttypestIntTypeRRRt showProgressR)tostpathtexiststseptjointresultRt seenNamest_[1]R tptstrtisdirtcacheTransformtpathstremovet ValueErrorR&tlent incrementstziptrangetindextdR tlistdirtsubDirstOSErrorterrtsterrnotEACCEStincrt plugindirttmlnamet isAModuleR(R,R/R2R5RR<RLRCRIR6RNR&RFRMR4R@RDRHR7R8((R tgetPluginFileListasp    Q   2     cCs%t|tiƒotidtdƒnt|tiƒotidtdƒng}t ||ƒ\}}|pt dƒ‚ndt |ƒ} d} xgttt |ƒƒ|ƒD]J\}}|| ƒ|d|ƒtiitii|ƒƒd} t| ƒ} hd | i<d |<} yt|| ƒWn,ttfj o}|d |ƒq¸nXt | i ƒpd}| d|}xh| i D]]}||i%jo"|i&|ƒ|d |fƒn|d |fƒ| |} || ƒq“W|d|ƒq¸W|dƒ|d|fƒ|S(sœTraverse the given list of files and attempt to load plugins from them. @type plugInType: C{str} @param plugInType: The type of plugin to search for. This is tested against the C{type} argument to the C{register} function in the plugin.tml files. @type fileList: C{list} of C{str} @param fileList: A list of the files to attempt to load plugin information from. One name is put in their scope, the C{register} function. @type debugInspection: C{None} or a callable taking one argument @param debugInspection: If not None, this is invoked with strings containing debug information about the loading process. If it is any other true value, this debug information is written to stdout (This behavior is deprecated). @type showProgress: C{None} or a callable taking one argument. @param showProgress: If not None, this is invoked with floating point values between 0 and 1 describing the progress of the loading process. If it is any other true value, this progress information is written to stdout. (This behavior is deprecated). @rtype: C{list} @return: A list of the C{PlugIn} objects found. snint parameter for debugInspection is deprecated, pass None or a function that takes a single argument instead.iskint parameter for showProgress is deprecated, pass None or a function that takes a single argument instead.s No plugins passed to loadPluginsf1.0f0.0s Loading from iþÿÿÿRt__file__sError loading: %ssFound %rsDisqualified %rsFinished loading from %s!s Returning %rN('R+R,R-R.RRRR/R5R)tfileListR>R?R@R&RARBRCttmlFileR0R1tsplittabspathtpnameRtdropinRtnstexecfiletIOErrorRGteRtldpRLtplugint plugInTypettypeR(R^RRR,R/RSR\R5RCRLR&RXRWRVR@R]R[((R t loadPluginsÀsN    "     cCs#tidtdƒt|||ƒS(sØHelper function to get all the plugins of a particular type. @type plugInType: C{str} @param plugInType: The type of plugin to search for. This is tested against the C{type} argument to the C{register} function in the plugin.tml files. @type debugInspection: C{None} or a callable taking one argument @param debugInspection: If not None, this is invoked with strings containing debug information about the loading process. If it is any other true value, this debug information is written to stdout (This behavior is deprecated). @type showProgress: C{None} or a callable taking one argument. @param showProgress: If not None, this is invoked with floating point values between 0 and 1 describing the progress of the loading process. If it is any other true value, this progress information is written to stdout. (This behavior is deprecated). @rtype: C{list} @return: A list of C{PlugIn} objects that were found. s\The twisted.python.plugin system is deprecated. See twisted.plugin for the revised edition.iN(RRRt _getPlugInsR^R,R/(R^R,R/((R t getPlugIns s  csÊt|tiƒotidtdƒntˆtiƒotidtdƒnt|ˆƒ\}‰d„}}ˆo‡d†}‡d†}nt ||ƒ}|pgSnt ||||ƒS(Nsnint parameter for debugInspection is deprecated, pass None or a function that takes a single argument instead.iskint parameter for showProgress is deprecated, pass None or a function that takes a single argument instead.cCsdS(N(R#(R!((R R"7scsˆ|dƒS(Nf2.0(R/R!(R!(R/(R R"9scsˆ|ddƒS(Nf2.0f0.5(R/R!(R!(R/(R R":s(R+R,R-R.RRRR/R)t firstHalft secondHalfRPttmlFilesR`R^(R^R,R/ReRcRd((R/R Ra(s    cCsjddddddg}tii}tii}x3|D]+}|||d|fƒƒodSq7q7Wd S( s;This function checks the directory for __init__ files. tpytpyctpyotsotpydtdlls __init__.%siiN(tsuffixesR0R1R2R3R4RIRD(RDR4R2RIRl((R ROAs   RPR`Rb(t __future__t nested_scopesR R0RJR-Rttwisted.pythonR'treflectRtos.pathtrealpathR;t ImportErrorRURRR)R#RPR`RbRaROt__all__(R'RRtRnRR;RJRRaRPR R)RRbR`ROR0R-((R t?s(        ! _M