webviewvc.in 2.61 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#!/usr/local/bin/python
# -*-python-*-
#
# Copyright (C) 1999-2002 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewCVS
# distribution or at http://viewcvs.sourceforge.net/license-1.html.
#
# Contact information:
#   Greg Stein, PO Box 760, Palo Alto, CA, 94302
#   gstein@lyra.org, http://viewcvs.sourceforge.net/
#

LIBRARY_DIR = r"/usr/testbed/viewcvs-1.0/lib"
CONF_PATHNAME = r"/usr/testbed/viewcvs-1.0/viewcvs.conf"

#########################################################################
#
# Adjust sys.path to include our library directory
#
import sys
import os
import re
25
import getopt
26 27 28 29 30 31

sys.path.insert(0, LIBRARY_DIR)

#
# We must get a -repo argument.
#
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
repodir  = False;
embedded = False;

try:
    # Parse the options,
    opts, req_args = getopt.getopt(sys.argv[1:], "",
                     [ "repo=", "embedded"])
    # ... act on them appropriately, and
    for opt, val in opts:
        if opt == "--repo":
	    repodir = val
            pass
        elif opt == "--embedded":
	    embedded = True;
            pass
        pass
    pass
except getopt.error, e:
50 51 52
    sys.exit(1)
    pass

53
if repodir == False:
54 55 56 57 58 59 60
    sys.exit(1)
    pass

# go do the work
import sapi
import viewcvs

61 62 63 64 65 66 67 68
viewcvs._legal_params['instance'] = viewcvs._re_validate_number
viewcvs._sticky_vars.append('instance')
viewcvs._legal_params['experiment'] = viewcvs._re_validate_number
viewcvs._sticky_vars.append('experiment')
viewcvs._legal_params['guid'] = re.compile('^[-_a-zA-Z0-9]+$')
viewcvs._sticky_vars.append('guid')
viewcvs._legal_params['version'] = viewcvs._re_validate_number
viewcvs._sticky_vars.append('version')
69 70 71 72 73 74
viewcvs._legal_params['exptidx'] = viewcvs._re_validate_number
viewcvs._sticky_vars.append('exptidx')
viewcvs._legal_params['eid'] = re.compile('^[-_a-zA-Z0-9]+$')
viewcvs._sticky_vars.append('eid')
viewcvs._legal_params['pid'] = viewcvs._re_validate_number
viewcvs._sticky_vars.append('pid')
75 76
viewcvs._legal_params['embedded'] = viewcvs._re_validate_number
viewcvs._sticky_vars.append('embedded')
77 78 79 80 81 82

server = sapi.CgiServer()
cfg = viewcvs.load_config(CONF_PATHNAME, server)

cfg.general.default_root = 'svn'
cfg.general.svn_roots    = {'svn' : repodir}
Leigh Stoller's avatar
Leigh Stoller committed
83
cfg.general.cvs_roots    = {}
84
cfg.options.docroot      = "/cvsweb/viewvc"
Leigh Stoller's avatar
Leigh Stoller committed
85 86
cfg.options.http_expiration_time = 10
cfg.options.generate_etags = 1
87
cfg.options.use_localtime  = 1
Leigh Stoller's avatar
Leigh Stoller committed
88
cfg.general.address      = "<a href='mailto:@TBOPSEMAIL_NOSLASH@'>@TBOPSEMAIL_NOSLASH@</a>"
89

90 91 92 93
if embedded:
    cfg.templates.directory = "templates/dir_emulab.ezt"
    pass

94
viewcvs.main(server, cfg)