source: soft/build_system/build_system/repsys/tags/V1_6_11/RepSys/cgiutil.py @ 1

Last change on this file since 1 was 1, checked in by fasma, 12 years ago

Initial Import from Mandriva's soft revision 224062 and package revision 45733

File size: 1.2 KB
Line 
1#!/usr/bin/python
2from RepSys import Error, config
3from RepSys.svn import SVN
4import time
5import re
6
7class CgiError(Error): pass
8
9class SubmitTarget:
10    def __init__(self):
11        self.name = ""
12        self.target = ""
13        self.allowed = []
14        self.scripts = []
15
16TARGETS = []
17
18def get_targets():
19    global TARGETS
20    if not TARGETS:
21        target = SubmitTarget()
22        targetoptions = {}
23        submit_re = re.compile("^submit\s+(.+)$")
24        for section in config.sections():
25            m = submit_re.match(section)
26            if m:
27                target = SubmitTarget()
28                target.name = m.group(1)
29                for option, value in config.walk(section):
30                    if option == "target":
31                        target.target = value.split()
32                    elif option == "allowed":
33                        target.allowed = value.split()
34                    elif option == "scripts":
35                        target.scripts = value.split()
36                    else:
37                        raise Error, "unknown [%s] option %s" % (section, option)
38                TARGETS.append(target)
39    return TARGETS
40
41# vim:et:ts=4:sw=4
Note: See TracBrowser for help on using the repository browser.