Mercurial > p > roundup > code
comparison roundup/scripts/roundup_server.py @ 1867:9b100d7bcb80
Use abspath() from os.path, it's been there since 1.5.2.
| author | Johannes Gijsbers <jlgijsbers@users.sourceforge.net> |
|---|---|
| date | Sat, 25 Oct 2003 11:20:17 +0000 |
| parents | d31a25046136 |
| children | 1545a36ae887 |
comparison
equal
deleted
inserted
replaced
| 1866:743f76c7deab | 1867:9b100d7bcb80 |
|---|---|
| 14 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | 14 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 15 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 15 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 16 # | 16 # |
| 17 """ HTTP Server that serves roundup. | 17 """ HTTP Server that serves roundup. |
| 18 | 18 |
| 19 $Id: roundup_server.py,v 1.29 2003-10-10 00:40:16 richard Exp $ | 19 $Id: roundup_server.py,v 1.30 2003-10-25 11:20:17 jlgijsbers Exp $ |
| 20 """ | 20 """ |
| 21 | 21 |
| 22 # python version check | 22 # python version check |
| 23 from roundup import version_check | 23 from roundup import version_check |
| 24 | 24 |
| 261 devnull = os.open('/dev/null', 0) | 261 devnull = os.open('/dev/null', 0) |
| 262 os.dup2(devnull, 0) | 262 os.dup2(devnull, 0) |
| 263 os.dup2(devnull, 1) | 263 os.dup2(devnull, 1) |
| 264 os.dup2(devnull, 2) | 264 os.dup2(devnull, 2) |
| 265 | 265 |
| 266 def abspath(path): | |
| 267 ''' Make the given path an absolute path. | |
| 268 | |
| 269 Code from Zope-Coders posting of 2002-10-06 by GvR. | |
| 270 ''' | |
| 271 if not os.path.isabs(path): | |
| 272 path = os.path.join(os.getcwd(), path) | |
| 273 return os.path.normpath(path) | |
| 274 | |
| 275 def run(): | 266 def run(): |
| 276 ''' Script entry point - handle args and figure out what to to. | 267 ''' Script entry point - handle args and figure out what to to. |
| 277 ''' | 268 ''' |
| 278 # time out after a minute if we can | 269 # time out after a minute if we can |
| 279 import socket | 270 import socket |
| 296 for (opt, arg) in optlist: | 287 for (opt, arg) in optlist: |
| 297 if opt == '-n': hostname = arg | 288 if opt == '-n': hostname = arg |
| 298 elif opt == '-p': port = int(arg) | 289 elif opt == '-p': port = int(arg) |
| 299 elif opt == '-u': user = arg | 290 elif opt == '-u': user = arg |
| 300 elif opt == '-g': group = arg | 291 elif opt == '-g': group = arg |
| 301 elif opt == '-d': pidfile = abspath(arg) | 292 elif opt == '-d': pidfile = os.path.abspath(arg) |
| 302 elif opt == '-l': logfile = abspath(arg) | 293 elif opt == '-l': logfile = os.path.abspath(arg) |
| 303 elif opt == '-h': usage() | 294 elif opt == '-h': usage() |
| 304 elif opt == '-N': RoundupRequestHandler.LOG_IPADDRESS = 0 | 295 elif opt == '-N': RoundupRequestHandler.LOG_IPADDRESS = 0 |
| 305 | 296 |
| 306 if pidfile and not logfile: | 297 if pidfile and not logfile: |
| 307 raise ValueError, _("logfile *must* be specified if pidfile is") | 298 raise ValueError, _("logfile *must* be specified if pidfile is") |
