Mercurial > p > roundup > code
diff setup.py @ 1640:d0b29215aa44
pre-release stuff
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Fri, 09 May 2003 05:04:34 +0000 |
| parents | 7034b61e9d9e |
| children | 41dbd406a79c |
line wrap: on
line diff
--- a/setup.py Fri May 09 04:35:05 2003 +0000 +++ b/setup.py Fri May 09 05:04:34 2003 +0000 @@ -16,7 +16,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: setup.py,v 1.50 2003-04-25 02:09:20 richard Exp $ +# $Id: setup.py,v 1.51 2003-05-09 05:04:33 richard Exp $ from distutils.core import setup, Extension from distutils.util import get_platform @@ -211,83 +211,7 @@ data_files = installdatafiles ) -def install_demo(): - ''' Install a demo server for users to play with for instant gratification. - - Sets up the web service on localhost port 8080. Disables nosy lists. - ''' - import shutil, socket, errno, BaseHTTPServer - - # create the instance - home = os.path.abspath('demo') - try: - shutil.rmtree(home) - except os.error, error: - if error.errno != errno.ENOENT: - raise - from roundup import init, instance, password - init.install(home, os.path.join('templates', 'classic')) - # don't have email flying around - os.remove(os.path.join(home, 'detectors', 'nosyreaction.py')) - init.write_select_db(home, 'anydbm') - - # figure basic params for server - hostname = socket.gethostname() - # pick a fairly odd, random port - port = 8917 - while 1: - print 'Trying to set up web server on port %d ...'%port, - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - try: - s.connect((hostname, port)) - except socket.error, e: - if not hasattr(e, 'args') or e.args[0] != errno.ECONNREFUSED: - raise - print 'should be ok.' - break - else: - s.close() - print 'already in use.' - port += 100 - url = 'http://%s:%s/demo/'%(hostname, port) - - # write the config - f = open(os.path.join(home, 'config.py'), 'r') - s = f.read().replace('http://tracker.example/cgi-bin/roundup.cgi/bugs/', - url) - f.close() - f = open(os.path.join(home, 'config.py'), 'w') - f.write(s) - f.close() - - # initialise the database - init.initialise(home, 'admin') - - # add the "demo" user - tracker = instance.open(home) - db = tracker.open('admin') - db.user.create(username='demo', password=password.Password('demo'), - realname='Demo User', roles='User') - db.commit() - db.close() - - # ok, so start up the server - from roundup.scripts.roundup_server import RoundupRequestHandler - RoundupRequestHandler.TRACKER_HOMES = {'demo': home} - httpd = BaseHTTPServer.HTTPServer((hostname, port), RoundupRequestHandler) - print 'Server running - connect to:\n %s'%url - print 'You may log in as "demo"/"demo" or "admin"/"admin".' - print 'Hit Control-C to stop the server.' - try: - httpd.serve_forever() - except KeyboardInterrupt: - print 'Keyboard Interrupt: exiting' - if __name__ == '__main__': - if len(sys.argv) > 1 and sys.argv[1] == 'demo': - install_demo() - else: - main() + main() # vim: set filetype=python ts=4 sw=4 et si
