annotate treepkg/readconfig.py @ 344:f06f707d9fda

merged branches/scratchbox into trunk #### IMPORTANT FOR ALL TREEPKGS ##### pbuilderrc config variable name changed to builderconfig
author Bjoern Ricks <bricks@intevation.de>
date Fri, 23 Apr 2010 07:43:29 +0000
parents a83a78a93fd6
children 41226e427823
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,""),
092925ff75d7 Added basic Git support, configuration options:
Andre Heinecke <aheinecke@intevation.de>
parents: 306
diff changeset
80 ("git_url", str,"")
2
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
81 ]
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 treepkg_desc = [
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
84 ("check_interval", int),
91
3ed079a7174a Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents: 52
diff changeset
85 "instructions_file",
2
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
86 ]
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
87
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 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
90 if defaults is None:
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
91 defaults = dict()
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
92 options = dict()
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
93 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
94 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
95 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
96 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
97 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
98 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
99 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
100 else:
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
101 key = item
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
102 converter = str
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
103 try:
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
104 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
105 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
106 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
107 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
108 else:
bb98e728f25b Allow default values for individual options to be passed to read_config_section.
Bernhard Herzog <bh@intevation.de>
parents: 234
diff changeset
109 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
110 % (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
111 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
112 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
113 return options
0
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
114
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
115
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
116 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
117 """Reads the tree packager configuration from the file given by filename.
0
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
118
115
d7b53e7df961 Fix doc-string
Bernhard Herzog <bh@intevation.de>
parents: 114
diff changeset
119 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
120 dicts ('packagers'). The treepkg dict contains the main
d7b53e7df961 Fix doc-string
Bernhard Herzog <bh@intevation.de>
parents: 114
diff changeset
121 configuration of the tree packager. The packagers list contains one
d7b53e7df961 Fix doc-string
Bernhard Herzog <bh@intevation.de>
parents: 114
diff changeset
122 dict with the configuratiin for each packager.
0
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
123 """
258
bb98e728f25b Allow default values for individual options to be passed to read_config_section.
Bernhard Herzog <bh@intevation.de>
parents: 234
diff changeset
124 parser = SafeConfigParser()
0
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
125 parser.read([filename])
2
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
126
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
127 # extract packager configurations
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
128 packagers = []
0
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
129 for section in parser.sections():
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
130 if section.startswith("pkg_"):
114
02c261e4443f Extend treepkg.readconfig.read_config:
Bernhard Herzog <bh@intevation.de>
parents: 93
diff changeset
131 vars = dict(name=section[4:])
02c261e4443f Extend treepkg.readconfig.read_config:
Bernhard Herzog <bh@intevation.de>
parents: 93
diff changeset
132 packager_class = parser.get(section, "packager_class", vars=vars)
02c261e4443f Extend treepkg.readconfig.read_config:
Bernhard Herzog <bh@intevation.de>
parents: 93
diff changeset
133 module = packager.import_packager_module(packager_class)
52
78cf5f6778ec Rename 'packagel ine' -> 'package track'
Bernhard Herzog <bh@intevation.de>
parents: 47
diff changeset
134 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
135 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
136 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
137 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
138 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
139 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
140 % (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
141 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
142 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
143 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
144 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
145 "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
146 % (section)
4
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents: 2
diff changeset
147 packagers.append(read_config_section(parser, section, desc,
114
02c261e4443f Extend treepkg.readconfig.read_config:
Bernhard Herzog <bh@intevation.de>
parents: 93
diff changeset
148 defaults=vars))
0
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
149
2
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
150 # main config
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
151 treepkg = read_config_section(parser, "treepkg", treepkg_desc)
0
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
152
2
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
153 return treepkg, packagers
0
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
154
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
155
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
156 if __name__ == "__main__":
2
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
157 import pprint
e6a9f4037f68 readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
158 print pprint.pprint(read_config(sys.argv[1]))
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)