]> jfr.im git - irc/quakenet/qwebirc.git/blobdiff - run.py
correct spelling of licence
[irc/quakenet/qwebirc.git] / run.py
diff --git a/run.py b/run.py
index 2abefd69be4df540080a6bc8050a3514838d3c79..2d44a3aea6e42385d3c39d4d736290d31cdf7237 100755 (executable)
--- a/run.py
+++ b/run.py
@@ -5,11 +5,11 @@ bin.compile.vcheck()
 
 DEFAULT_PORT = 9090
 
-from twisted.scripts.twistd import run
 from optparse import OptionParser
 import sys, os, config
 
 def run_twistd(args1=None, args2=None):
+  from twisted.scripts.twistd import run
   args = [sys.argv[0]]
   if args1 is not None:
     args.extend(args1)
@@ -40,6 +40,8 @@ parser.add_option("-k", "--key", help="Path to SSL key.", dest="sslkey")
 parser.add_option("-H", "--certificate-chain", help="Path to SSL certificate chain file.", dest="sslchain")
 parser.add_option("-P", "--pidfile", help="Path to store PID file", dest="pidfile")
 parser.add_option("-s", "--syslog", help="Log to syslog", action="store_true", dest="syslog", default=False)
+parser.add_option("--profile", help="Run in profile mode, dumping results to this file", dest="profile")
+parser.add_option("--profiler", help="Name of profiler to use", dest="profiler")
 parser.add_option("--syslog-prefix", help="Syslog prefix", dest="syslog_prefix", default="qwebirc")
 
 sargs = sys.argv[1:]
@@ -57,13 +59,19 @@ if options.debug:
   args1.append("-b")
 
 if options.reactor != DEFAULT_REACTOR:
-  args1+=["--reactor", options.reactor]
+  rn = options.reactor + "reactor"
+  getattr(__import__("twisted.internet", fromlist=[rn]), rn).install()
 if options.logfile:
   args1+=["--logfile", options.logfile]
 if options.pidfile:
   args1+=["--pidfile", options.pidfile]
 if options.syslog:
   args1+=["--syslog"]
+if options.profile:
+  args1+=["--profile", options.profile]
+if options.profiler:
+  args1+=["--profiler", options.profiler]
+
 if options.syslog and options.syslog_prefix:
   import syslog
   syslog.openlog(options.syslog_prefix)