annotate treepkg/readconfig.py @ 387:c1f3be727f9d treepkg-status

renamed new status dir to info because of a naming conflict with status.py let the user specify a treepkg name in the config the name is propagated to PackagerGroup [treepkg] name: <treepkgname> becomes: pg = PackagerGroup(...) pg.name
author Bjoern Ricks <bricks@intevation.de>
date Thu, 08 Jul 2010 10:07:39 +0000
parents 41226e427823
children a690fc689f2f
rev   line source
234
eaa696629a91 Add a way to specify the svn URL of the repository with the debian rules
Bernhard Herzog <bh@intevation.de>
parents: 167
diff changeset
1 # Copyright (C) 2007, 2008, 2009 by Intevation GmbH
0
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
2 # Authors:
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
3 # Bernhard Herzog <bh@intevation.de>
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
4 #
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
5 # This program is free software under the GPL (>=v2)
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
6 # Read the file COPYING coming with the software for details.
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
7
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
8 """Reads the configuration file"""
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
9
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
10 import sys
2
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
11 import shlex
0
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
12 from ConfigParser import SafeConfigParser, NoOptionError
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
13
4
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents: 2
diff changeset
14 import util
114
02c261e4443f Extend treepkg.readconfig.read_config:
Bernhard Herzog <bh@intevation.de>
parents: 93
diff changeset
15 import packager
4
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents: 2
diff changeset
16
129
ce9f046058b5 Add the handle_dependencies Option for the config file. Extend the test
Bernhard Herzog <bh@intevation.de>
parents: 115
diff changeset
17 def convert_bool(s):
ce9f046058b5 Add the handle_dependencies Option for the config file. Extend the test
Bernhard Herzog <bh@intevation.de>
parents: 115
diff changeset
18 s = s.lower()
ce9f046058b5 Add the handle_dependencies Option for the config file. Extend the test
Bernhard Herzog <bh@intevation.de>
parents: 115
diff changeset
19 if s in ("true", "yes", "1"):
ce9f046058b5 Add the handle_dependencies Option for the config file. Extend the test
Bernhard Herzog <bh@intevation.de>
parents: 115
diff changeset
20 return True
ce9f046058b5 Add the handle_dependencies Option for the config file. Extend the test
Bernhard Herzog <bh@intevation.de>
parents: 115
diff changeset
21 if s in ("false", "no", "0"):
ce9f046058b5 Add the handle_dependencies Option for the config file. Extend the test
Bernhard Herzog <bh@intevation.de>
parents: 115
diff changeset
22 return False
ce9f046058b5 Add the handle_dependencies Option for the config file. Extend the test
Bernhard Herzog <bh@intevation.de>
parents: 115
diff changeset
23 raise ValueError("cannot determine boolean value of %r" % (s,))
ce9f046058b5 Add the handle_dependencies Option for the config file. Extend the test
Bernhard Herzog <bh@intevation.de>
parents: 115
diff changeset
24
0
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
25
304
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
26 def convert_subversion_subset(raw):
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
27 """Converts the string representation an svn subset into internal form
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
28 The format in the config file is typically:
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
29 svn_url: svn://example.com/repository/trunk
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
30 svn_subset: -N .
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
31 subdir1
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
32 subdir2
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
33
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
34 Each line of the svn_subset value consists of an optional flag
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
35 followed by a subdirectory. Empty lines are ignored. Each
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
36 non-empty line is split into words using shlex.split, so whitespace
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
37 characters can be included in filenames using e.g. quotes (see the
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
38 shlex documentation for details). The only flag supported is -N
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
39 which indicates that the subdirectory on that line is not to be
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
40 checked out recursively. If -N is given on a line, svn checkout
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
41 will be called with -N as parameter.
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
42
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
43 The example above will be converted into the internal form [('.',
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
44 False), ('subdir1', True), ('subdir2', True)] used by the
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
45 treepkg.subversion module.
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
46 """
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
47 subset = []
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
48 for line in raw.splitlines():
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
49 split = shlex.split(line)
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
50 if len(split) < 1:
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
51 # ignore empty lines
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
52 continue
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
53 subdir = split[-1]
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
54 recurse = True
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
55 flags = split[:-1]
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
56 if flags:
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
57 if flags == ["-N"]:
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
58 recurse = False
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
59 else:
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
60 raise ValueError("Only -N is supported as flag, but flags = %r"
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
61 % (flags,))
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
62 subset.append((subdir, recurse))
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
63 return subset
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
64
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
65
2
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
66 packager_desc = [
304
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
67 "name", "base_dir",
321
092925ff75d7 Added basic Git support, configuration options:
Andre Heinecke <aheinecke@intevation.de>
parents: 306
diff changeset
68 ("svn_url", str,""),
092925ff75d7 Added basic Git support, configuration options:
Andre Heinecke <aheinecke@intevation.de>
parents: 306
diff changeset
69 ("svn_subset", convert_subversion_subset, ""),
306
163f0d8b64eb Make the svn external subdirectories configurable in the configuration
Bernhard Herzog <bh@intevation.de>
parents: 305
diff changeset
70 ("svn_externals", shlex.split, ""),
304
6cffb43a28ca Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents: 300
diff changeset
71 ("rules_svn_url", str, ""), "packager_class",
344
f06f707d9fda merged branches/scratchbox into trunk
Bjoern Ricks <bricks@intevation.de>
parents: 340
diff changeset
72 ("root_cmd", shlex.split, "sudo"), "builderconfig",
297
4dd6ec3a1151 Make it possible to use parallel builds for packages that support it:
Bernhard Herzog <bh@intevation.de>
parents: 293
diff changeset
73 "deb_email", "deb_fullname", ("deb_build_options", str, ""),
305
3781e9958eba Add per-track configuration option version_template used by the
Bernhard Herzog <bh@intevation.de>
parents: 304
diff changeset
74 ("version_template", str, "%(revision)s"),
299
c32dc72ba979 Turn the SourcePackager class attribute pkg_basename into a per-track
Bernhard Herzog <bh@intevation.de>
parents: 297
diff changeset
75 "pkg_revision_template", ("pkg_basename", str, ""),
129
ce9f046058b5 Add the handle_dependencies Option for the config file. Extend the test
Bernhard Herzog <bh@intevation.de>
parents: 115
diff changeset
76 ("handle_dependencies", convert_bool),
258
bb98e728f25b Allow default values for individual options to be passed to read_config_section.
Bernhard Herzog <bh@intevation.de>
parents: 234
diff changeset
77 ("signing_key_id", str, ""),
340
a83a78a93fd6 Changed default message templates to the correct types
Andre Heinecke <aheinecke@intevation.de>
parents: 332
diff changeset
78 ("changelog_msg_template", str, "Update to revision %(revision)s"),
321
092925ff75d7 Added basic Git support, configuration options:
Andre Heinecke <aheinecke@intevation.de>
parents: 306
diff changeset
79 ("git_branch", str,""),
378
41226e427823 Added an option to configure the used builder class from the treepkg.cfg. This
Andre Heinecke <aheinecke@intevation.de>
parents: 344
diff changeset
80 ("git_url", str,""),
41226e427823 Added an option to configure the used builder class from the treepkg.cfg. This
Andre Heinecke <aheinecke@intevation.de>
parents: 344
diff changeset
81 ("builder_cls",str,"PBuilder")
2
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
82 ]
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
83
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
84 treepkg_desc = [
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
85 ("check_interval", int),
91
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 52
diff changeset
86 "instructions_file",
387
c1f3be727f9d renamed new status dir to info because of a naming conflict with status.py
Bjoern Ricks <bricks@intevation.de>
parents: 378
diff changeset
87 ("name", str, "")
2
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
88 ]
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
89
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
90
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
91 def read_config_section(parser, section, item_desc, defaults=None):
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
92 if defaults is None:
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
93 defaults = dict()
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
94 options = dict()
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
95 for item in item_desc:
258
bb98e728f25b Allow default values for individual options to be passed to read_config_section.
Bernhard Herzog <bh@intevation.de>
parents: 234
diff changeset
96 has_default_value = False
2
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
97 if isinstance(item, tuple):
258
bb98e728f25b Allow default values for individual options to be passed to read_config_section.
Bernhard Herzog <bh@intevation.de>
parents: 234
diff changeset
98 key, converter = item[:2]
bb98e728f25b Allow default values for individual options to be passed to read_config_section.
Bernhard Herzog <bh@intevation.de>
parents: 234
diff changeset
99 if len(item) == 3:
bb98e728f25b Allow default values for individual options to be passed to read_config_section.
Bernhard Herzog <bh@intevation.de>
parents: 234
diff changeset
100 default_value = item[-1]
bb98e728f25b Allow default values for individual options to be passed to read_config_section.
Bernhard Herzog <bh@intevation.de>
parents: 234
diff changeset
101 has_default_value = True
2
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
102 else:
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
103 key = item
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
104 converter = str
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
105 try:
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
106 value = parser.get(section, key, vars=defaults)
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
107 except NoOptionError:
258
bb98e728f25b Allow default values for individual options to be passed to read_config_section.
Bernhard Herzog <bh@intevation.de>
parents: 234
diff changeset
108 if has_default_value:
bb98e728f25b Allow default values for individual options to be passed to read_config_section.
Bernhard Herzog <bh@intevation.de>
parents: 234
diff changeset
109 value = default_value
bb98e728f25b Allow default values for individual options to be passed to read_config_section.
Bernhard Herzog <bh@intevation.de>
parents: 234
diff changeset
110 else:
bb98e728f25b Allow default values for individual options to be passed to read_config_section.
Bernhard Herzog <bh@intevation.de>
parents: 234
diff changeset
111 print >>sys.stderr, "Missing option %r in section %r" \
bb98e728f25b Allow default values for individual options to be passed to read_config_section.
Bernhard Herzog <bh@intevation.de>
parents: 234
diff changeset
112 % (key, section)
bb98e728f25b Allow default values for individual options to be passed to read_config_section.
Bernhard Herzog <bh@intevation.de>
parents: 234
diff changeset
113 sys.exit(1)
bb98e728f25b Allow default values for individual options to be passed to read_config_section.
Bernhard Herzog <bh@intevation.de>
parents: 234
diff changeset
114 options[key] = converter(value)
2
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
115 return options
0
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
116
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
117
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
118 def read_config(filename):
2
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
119 """Reads the tree packager configuration from the file given by filename.
0
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
120
115
d7b53e7df961 Fix doc-string
Bernhard Herzog <bh@intevation.de>
parents: 114
diff changeset
121 The function returns a tuple with a dict ('treepkg') and a list of
d7b53e7df961 Fix doc-string
Bernhard Herzog <bh@intevation.de>
parents: 114
diff changeset
122 dicts ('packagers'). The treepkg dict contains the main
d7b53e7df961 Fix doc-string
Bernhard Herzog <bh@intevation.de>
parents: 114
diff changeset
123 configuration of the tree packager. The packagers list contains one
d7b53e7df961 Fix doc-string
Bernhard Herzog <bh@intevation.de>
parents: 114
diff changeset
124 dict with the configuratiin for each packager.
0
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
125 """
258
bb98e728f25b Allow default values for individual options to be passed to read_config_section.
Bernhard Herzog <bh@intevation.de>
parents: 234
diff changeset
126 parser = SafeConfigParser()
0
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
127 parser.read([filename])
2
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
128
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
129 # extract packager configurations
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
130 packagers = []
0
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
131 for section in parser.sections():
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
132 if section.startswith("pkg_"):
114
02c261e4443f Extend treepkg.readconfig.read_config:
Bernhard Herzog <bh@intevation.de>
parents: 93
diff changeset
133 vars = dict(name=section[4:])
02c261e4443f Extend treepkg.readconfig.read_config:
Bernhard Herzog <bh@intevation.de>
parents: 93
diff changeset
134 packager_class = parser.get(section, "packager_class", vars=vars)
02c261e4443f Extend treepkg.readconfig.read_config:
Bernhard Herzog <bh@intevation.de>
parents: 93
diff changeset
135 module = packager.import_packager_module(packager_class)
52
78cf5f6778ec Rename 'packagel ine' -> 'package track'
Bernhard Herzog <bh@intevation.de>
parents: 47
diff changeset
136 desc = packager_desc + module.PackageTrack.extra_config_desc
332
e0e99b71932b Added check in readconfig if either a git_url or a svn_url is provided
Andre Heinecke <aheinecke@intevation.de>
parents: 321
diff changeset
137 packager_options = (read_config_section(parser, section, desc,
e0e99b71932b Added check in readconfig if either a git_url or a svn_url is provided
Andre Heinecke <aheinecke@intevation.de>
parents: 321
diff changeset
138 defaults=vars))
e0e99b71932b Added check in readconfig if either a git_url or a svn_url is provided
Andre Heinecke <aheinecke@intevation.de>
parents: 321
diff changeset
139 if not packager_options.get("svn_url") \
e0e99b71932b Added check in readconfig if either a git_url or a svn_url is provided
Andre Heinecke <aheinecke@intevation.de>
parents: 321
diff changeset
140 and not packager_options.get('git_url'):
e0e99b71932b Added check in readconfig if either a git_url or a svn_url is provided
Andre Heinecke <aheinecke@intevation.de>
parents: 321
diff changeset
141 print >>sys.stderr, "Missing repository URL in section %r" \
e0e99b71932b Added check in readconfig if either a git_url or a svn_url is provided
Andre Heinecke <aheinecke@intevation.de>
parents: 321
diff changeset
142 % (section)
e0e99b71932b Added check in readconfig if either a git_url or a svn_url is provided
Andre Heinecke <aheinecke@intevation.de>
parents: 321
diff changeset
143 sys.exit(1)
e0e99b71932b Added check in readconfig if either a git_url or a svn_url is provided
Andre Heinecke <aheinecke@intevation.de>
parents: 321
diff changeset
144 elif packager_options.get("svn_url") \
e0e99b71932b Added check in readconfig if either a git_url or a svn_url is provided
Andre Heinecke <aheinecke@intevation.de>
parents: 321
diff changeset
145 and packager_options.get('git_url'):
e0e99b71932b Added check in readconfig if either a git_url or a svn_url is provided
Andre Heinecke <aheinecke@intevation.de>
parents: 321
diff changeset
146 print >>sys.stderr, \
e0e99b71932b Added check in readconfig if either a git_url or a svn_url is provided
Andre Heinecke <aheinecke@intevation.de>
parents: 321
diff changeset
147 "Warning: git_url in section %r will be ignored" \
e0e99b71932b Added check in readconfig if either a git_url or a svn_url is provided
Andre Heinecke <aheinecke@intevation.de>
parents: 321
diff changeset
148 % (section)
4
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents: 2
diff changeset
149 packagers.append(read_config_section(parser, section, desc,
114
02c261e4443f Extend treepkg.readconfig.read_config:
Bernhard Herzog <bh@intevation.de>
parents: 93
diff changeset
150 defaults=vars))
0
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
151
2
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
152 # main config
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
153 treepkg = read_config_section(parser, "treepkg", treepkg_desc)
0
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
154
2
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
155 return treepkg, packagers
0
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
156
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
157
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
158 if __name__ == "__main__":
2
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
159 import pprint
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
160 print pprint.pprint(read_config(sys.argv[1]))
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)