m !Ec@sudkZdkZdkZdkZdkZdkZdklZlZl Z l Z l Z l Z l Z dklZdklZlZdklZdklZdklZdZdZd Zd Zd Zd Zd efdYZ dZ!dZ"dZ#dfdYZ$de i%e$fdYZ&dZ'dZ(dZ)dZ*dZ+dS(N(sruntimeslogsusagesreflectsfailuresutilslogfile(ssob(sservicesreactors(sdefer(s copyright(sinstallReactorcCsy dk}Wnhtj o\}d|}|d7}tidtiti|ti t i d|dnX|i }|i|i|do|i|dnHt it|dd}t _|i|t it _}|idS( s$Run reactor under standard profiler.Ns#Failed to import module profile: %ss This is most likely caused by your operating system not including profile.py due to it being non-free. Either do not use the option --profile, or install profile.py; your operating system vendor may provide it in a separate package. tfiles t savestatstprofileta(Rt ImportErrortetst tracebackt print_exctlogtlogfiletmsgtdeferrtsystexittProfiletptruncalltreactortruntconfigt dump_statststdouttopenttmpt print_statstclose(RRRRRRR((to/home/radix/Projects/Twisted/branches/releases/twisted-core-2.5.x-2329-2/Twisted.exp/twisted/application/app.pytrunWithProfilers$         cCs&y dk}Wnhtj o\}d|}|d7}tidtiti |ti t i d|dnX|i |d}|i|i|dodSnu|ii|d}|i|idt it|dd }t _|i|t it _}|idS( s#Run reactor under hotshot profiler.Ns#Failed to import module hotshot: %ss This is most likely caused by your operating system not including profile.py due to it being non-free. Either do not use the option --profile, or install profile.py; your operating system vendor may provide it in a separate package. Rs RRitw(t hotshot.statsthotshotRRRRRR R R R R RRRRRRRtstatstloadt strip_dirst sort_statsRRRRR(RRRRRRR((RtrunWithHotshot.s*          cCsCd}d}d}|ti_|ti_|ti_dS(NcCs8|i|idkl}|id|idS(N(sreactorii(tselftclear_all_breakst set_continuettwisted.internetRt callLatertstop(R%targR((Rtdo_stopOs    cCs dGHdS(NsEstop - Continue execution, then cleanly shutdown the twisted reactor.((R%((Rt help_stopVscCstiddS(Ni(tost_exit(R%((Rtset_quitYs(R,R-R0tpdbtPdb(R,R0R-((RtfixPdbNs      cCsdkl}y|do-|dpt||qt||n|dom|t_|t_ t i djo0t i t i dt i t idntti|in |iWnE|do |}ntd d }tid ||inXdS( N(sreactorRt nothotshottdebugtposixcGs tiS(N(R1t set_trace(targs((RtlscGs tiS(N(R1R7(R8((RR9mstnodaemonsTWISTD-CRASH.logRR(R(RRR$Rt oldstdoutR Rt oldstderrtstderrtruntimet platformTypetsignaltSIGUSR2tSIGINTR3R1RRRRRRtflush(RR;R<RR((RtrunReactorWithLogging`s*        cCs |otidSndSdS(Ns Passphrase: (tneededtgetpasstNone(RE((Rt getPassphrase{scCs"|otid}ndSdS(NsEncryption passphrase: (REtutilt getPasswordt passphraseRG(RERK((RtgetSavePassphrasestApplicationRunnercBs;tZdZdZdZdZdZdZRS(s An object which helps running an application based on a config object. Subclass me and implement preApplication and postApplication methods. postApplication generally will want to run the reactor after starting the application. @ivar config: The config object, which provides a dict-like interface. @ivar application: Available in postApplication, but not preApplication. This is the application object. cCs ||_dS(N(RR%(R%R((Rt__init__scCs'|i|i|_|idS(sRun the application.N(R%tpreApplicationtcreateOrGetApplicationt applicationtpostApplication(R%((RRs cCs tdS(s Override in subclass. This should set up any state necessary before loading and running the Application. N(tNotImplementedError(R%((RROscCs tdS(s Override in subclass. This will be called after the application has been loaded (so the C{application} attribute will be set). Generally this should start the application and run the reactor. N(RS(R%((RRRscCs|iioN|ii|ii}|i|ii}ti |i }|i |n&t |id}t|i|}|S(s Create or load an Application based on the parameters found in the given L{ServerOptions} instance. If a subcommand was used, the L{service.IServiceMaker} that it represents will be used to construct a service to be added to a newly-created Application. Otherwise, an application will be loaded based on parameters in the config. t encryptedN(R%Rt subCommandt loadedPluginstplgt makeServicet subOptionstsertservicet ApplicationttapnameRQtsetServiceParentRHRKtgetApplication(R%RZRWRQRK((RRPs  (t__name__t __module__t__doc__RNRRORRRP(((RRMs    c CsFg}ddddgD]&}||o||||fqq~d}|dhdd Provides options for selecting a reactor to install. RcCs>x+tiD]}dG|iGdG|iGHq WtddS(sE Display a list of possibly available reactor names. s s iN(RxRyRzR{t descriptiont SystemExit(R%Rz((Rtopt_help_reactorss  cCst|dS(sX Which reactor to use (see --help-reactors for a list of possibilities) N(tinstallReactorR{(R%R{((Rt opt_reactor s(R`RaRbR|t zsh_actionsRRtopt_r(((RR}s  t ServerOptionsc BsCtZdddgdddgdddgd dd ggZd d dd gddddgddddgddddgddddgddddgddd d!gd"ddd#ggZd/gZhdd$<dd%<dd&<dd'<dd(tshortPythonVersiont __class__(R((Rt initialLog~s &cCskti|||}ti|i|t |}|o d}nti|id|d|dS(NRjRK(R[RltfileinttypeinRKRQtsobt IPersistabletsetStylettypeoutRLtencryptRGtfileouttsave(RRRKRRRRQ((Rt convertStyles   cCsvdkl}ti|i|o,ti|}|i dd|idn|i ddti|i dS(N(sreactortaftertshutdowntbefore( R(RR[tIServiceRQt startServiceRRRRtaddSystemEventTriggert stopService(RQRRR((RtstartApplications  cCs@tii|}titii|tii|}|S(N( R.tpathtabspatht logfilenametlogPathR tLogFiletbasenametdirnametlogFile(RRR((Rt getLogFiles(,R R.R1RFRR@ttwisted.pythonR>R RtreflectRRIR ttwisted.persistedRttwisted.applicationR[RxR(RRRttwisted.application.reactorsRRR$R3RDRHRLtobjectRMR_RuR|R}RRRRRRR($RRRRR3RFRMRLRR R[RRDRRR$RRuRRIRRHR}R R RR_R@RRR1R|RR>R.Rx((Rt?s.61         I  Y