1717
1818"""Command-line script that runs a server over roundup.cgi.client.
1919
20- $Id: roundup_server.py,v 1.42 2004-04-05 00:54:23 richard Exp $
20+ $Id: roundup_server.py,v 1.43 2004-04-05 23:43:04 richard Exp $
2121"""
2222__docformat__ = 'restructuredtext'
2323
2424# python version check
2525from roundup import version_check
26+ from roundup import __version__ as roundup_version
2627
2728import sys , os , urllib , StringIO , traceback , cgi , binascii , getopt , imp
2829import BaseHTTPServer , socket , errno
@@ -350,6 +351,7 @@ def usage(message=''):
350351roundup-server [options] [name=tracker home]*
351352
352353options:
354+ -v: print version and exit
353355 -n: sets the host name
354356 -p: sets the port to listen on (default: %(port)s)
355357 -u: sets the uid to this user after listening on the port
@@ -397,9 +399,9 @@ def daemonize(pidfile):
397399 pidfile = open (pidfile , 'w' )
398400 pidfile .write (str (pid ))
399401 pidfile .close ()
400- os ._exit (0 )
402+ os ._exit (0 )
401403
402- os .chdir ("/" )
404+ os .chdir ("/" )
403405 os .umask (0 )
404406
405407 # close off sys.std(in|out|err), redirect to devnull so the file
@@ -426,7 +428,7 @@ def run(port=PORT, success_message=None):
426428
427429 try :
428430 # handle the command-line args
429- options = 'n:p:u:d:l:hN '
431+ options = 'n:p:u:d:l:hNv '
430432 if RoundupService :
431433 options += 'c'
432434
@@ -439,6 +441,9 @@ def run(port=PORT, success_message=None):
439441 group = None
440442 for (opt , arg ) in optlist :
441443 if opt == '-n' : hostname = arg
444+ elif opt == '-v' :
445+ print '%s (python %s)' % (roundup_version , sys .version .split ()[0 ])
446+ return
442447 elif opt == '-p' : port = int (arg )
443448 elif opt == '-u' : user = arg
444449 elif opt == '-g' : group = arg
0 commit comments