Index: twisted/internet/reactors.py =================================================================== RCS file: twisted/internet/reactors.py diff -N twisted/internet/reactors.py --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ twisted/internet/reactors.py 24 Jul 2003 01:15:00 -0000 @@ -0,0 +1,31 @@ +# Twisted, the Framework of Your Internet +# Copyright (C) 2001-2003 Matthew W. Lefkowitz +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of version 2.1 of the GNU Lesser General Public +# License as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +"""Table of reactors.""" + +reactorTypes = { + 'gtk': 'twisted.internet.gtkreactor', + 'gtk2': 'twisted.internet.gtk2reactor', + 'glade': 'twisted.internet.gladereactor', + 'default': 'twisted.internet.default', + 'win32': 'twisted.internet.win32eventreactor', + 'win': 'twisted.internet.win32eventreactor', + 'poll': 'twisted.internet.pollreactor', + 'qt': 'twisted.internet.qtreactor', + 'c' : 'twisted.internet.cReactor', + 'kqueue': 'twisted.internet.kqreactor' + } Index: twisted/scripts/trial.py =================================================================== RCS file: /cvs/Twisted/twisted/scripts/trial.py,v retrieving revision 1.46 diff -u -r1.46 trial.py --- twisted/scripts/trial.py 19 Jul 2003 21:36:49 -0000 1.46 +++ twisted/scripts/trial.py 24 Jul 2003 01:15:02 -0000 @@ -18,6 +18,7 @@ # FIXME # - Hangs. +from twisted.internet.reactors import reactorTypes from twisted.python import usage, reflect, failure from twisted.trial import unittest, util, reporter as reps import sys, os, types, inspect @@ -39,7 +40,7 @@ ["recurse", "R", "Search packages recursively"]] optParameters = [["reactor", "r", None, - "The Twisted reactor to install before running the tests (looked up as a module contained in twisted.internet)"], + 'Which reactor to use out of: %s.' % ', '.join(reactorTypes.keys())], ["logfile", "l", "test.log", "log file name"], ["random", "z", None, "Run tests in random order using the specified seed"], @@ -58,10 +59,11 @@ def opt_reactor(self, reactorName): # this must happen before parseArgs does lots of imports - mod = 'twisted.internet.' + reactorName + mod = reactorTypes.get(reactorName) + if mod is None: mod = 'twisted.internet.' + reactorName print "Using %s reactor" % mod reflect.namedModule(mod).install() - + def opt_testmodule(self, file): "Module to find a test case for" # only look at the first two lines of the file. Try to behave as Index: twisted/scripts/twistd.py =================================================================== RCS file: /cvs/Twisted/twisted/scripts/twistd.py,v retrieving revision 1.53 diff -u -r1.53 twistd.py --- twisted/scripts/twistd.py 19 Jul 2003 21:36:49 -0000 1.53 +++ twisted/scripts/twistd.py 24 Jul 2003 01:15:03 -0000 @@ -17,6 +17,7 @@ from __future__ import nested_scopes from twisted import copyright +from twisted.internet.reactors import reactorTypes from twisted.python import usage, util, runtime from twisted.python import log, logfile @@ -37,19 +38,6 @@ import traceback import imp import sys, os, errno - -reactorTypes = { - 'gtk': 'twisted.internet.gtkreactor', - 'gtk2': 'twisted.internet.gtk2reactor', - 'glade': 'twisted.internet.gladereactor', - 'default': 'twisted.internet.default', - 'win32': 'twisted.internet.win32eventreactor', - 'win': 'twisted.internet.win32eventreactor', - 'poll': 'twisted.internet.pollreactor', - 'qt': 'twisted.internet.qtreactor', - 'c' : 'twisted.internet.cReactor', - 'kqueue': 'twisted.internet.kqreactor' - } class ServerOptions(usage.Options):