source: soft/build_system/build_system/repsys/tags/V1_5_7/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.1 KB
Line 
1#!/usr/bin/python
2from RepSys import Error, config
3from RepSys.svn import SVN
4import time
5
6class CgiError(Error): pass
7
8class SubmitTarget:
9    def __init__(self):
10        self.name = ""
11        self.target = ""
12        self.allowed = []
13        self.scripts = []
14
15TARGETS = []
16
17def get_targets():
18    global TARGETS
19    if not TARGETS:
20        target = SubmitTarget()
21        targetoptions = {}
22        for option, value in config.walk("submit"):
23            if targetoptions.has_key(option):
24                TARGETS.append(target)
25                target = SubmitTarget()
26                targetoptions = {}
27            targetoptions[option] = 1
28            if option == "name":
29                target.name = value
30            elif 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 [submit] option %s" % option
38        if targetoptions:
39            TARGETS.append(target)
40    return TARGETS
41
42# vim:et:ts=4:sw=4
Note: See TracBrowser for help on using the repository browser.