Mercurial > treepkg > treepkg
annotate treepkg/readconfig.py @ 391:89ecca5d262e treepkg-status
check if config file exists to get usefull error output
author | Bjoern Ricks <bricks@intevation.de> |
---|---|
date | Thu, 08 Jul 2010 16:08:39 +0000 |
parents | a690fc689f2f |
children | 2db42a2a9db9 |
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 | 2 # Authors: |
3 # Bernhard Herzog <bh@intevation.de> | |
4 # | |
5 # This program is free software under the GPL (>=v2) | |
6 # Read the file COPYING coming with the software for details. | |
7 | |
8 """Reads the configuration file""" | |
9 | |
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 |
391
89ecca5d262e
check if config file exists to get usefull error output
Bjoern Ricks <bricks@intevation.de>
parents:
389
diff
changeset
|
12 import os.path |
0 | 13 from ConfigParser import SafeConfigParser, NoOptionError |
14 | |
4
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
2
diff
changeset
|
15 import util |
114
02c261e4443f
Extend treepkg.readconfig.read_config:
Bernhard Herzog <bh@intevation.de>
parents:
93
diff
changeset
|
16 import packager |
4
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
2
diff
changeset
|
17 |
129
ce9f046058b5
Add the handle_dependencies Option for the config file. Extend the test
Bernhard Herzog <bh@intevation.de>
parents:
115
diff
changeset
|
18 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
|
19 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
|
20 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
|
21 return True |
ce9f046058b5
Add the handle_dependencies Option for the config file. Extend the test
Bernhard Herzog <bh@intevation.de>
parents:
115
diff
changeset
|
22 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
|
23 return False |
ce9f046058b5
Add the handle_dependencies Option for the config file. Extend the test
Bernhard Herzog <bh@intevation.de>
parents:
115
diff
changeset
|
24 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
|
25 |
0 | 26 |
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
|
27 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
|
28 """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
|
29 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
|
30 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
|
31 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
|
32 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
|
33 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
|
34 |
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 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
|
36 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
|
37 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
|
38 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
|
39 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
|
40 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
|
41 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
|
42 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
|
43 |
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 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
|
45 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
|
46 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
|
47 """ |
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 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
|
49 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
|
50 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
|
51 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
|
52 # 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
|
53 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
|
54 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
|
55 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
|
56 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
|
57 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
|
58 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
|
59 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
|
60 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
|
61 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
|
62 % (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
|
63 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
|
64 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
|
65 |
6cffb43a28ca
Add a way to specify svn subset checkouts where only parts of a source
Bernhard Herzog <bh@intevation.de>
parents:
300
diff
changeset
|
66 |
2
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
67 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
|
68 "name", "base_dir", |
321
092925ff75d7
Added basic Git support, configuration options:
Andre Heinecke <aheinecke@intevation.de>
parents:
306
diff
changeset
|
69 ("svn_url", str,""), |
092925ff75d7
Added basic Git support, configuration options:
Andre Heinecke <aheinecke@intevation.de>
parents:
306
diff
changeset
|
70 ("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
|
71 ("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
|
72 ("rules_svn_url", str, ""), "packager_class", |
344
f06f707d9fda
merged branches/scratchbox into trunk
Bjoern Ricks <bricks@intevation.de>
parents:
340
diff
changeset
|
73 ("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
|
74 "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
|
75 ("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
|
76 "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
|
77 ("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
|
78 ("signing_key_id", str, ""), |
340
a83a78a93fd6
Changed default message templates to the correct types
Andre Heinecke <aheinecke@intevation.de>
parents:
332
diff
changeset
|
79 ("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
|
80 ("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
|
81 ("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
|
82 ("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
|
83 ] |
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
84 |
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
85 treepkg_desc = [ |
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
86 ("check_interval", int), |
91
3ed079a7174a
Implement a way to stop a running treepackager.
Bernhard Herzog <bh@intevation.de>
parents:
52
diff
changeset
|
87 "instructions_file", |
389
a690fc689f2f
added treepkg_dir andd tracks_dir attributes to PackageGroup
Bjoern Ricks <bricks@intevation.de>
parents:
387
diff
changeset
|
88 ("name", str, ""), |
a690fc689f2f
added treepkg_dir andd tracks_dir attributes to PackageGroup
Bjoern Ricks <bricks@intevation.de>
parents:
387
diff
changeset
|
89 ("treepkg_dir", str, None), |
a690fc689f2f
added treepkg_dir andd tracks_dir attributes to PackageGroup
Bjoern Ricks <bricks@intevation.de>
parents:
387
diff
changeset
|
90 ("tracks_dir", str, None) |
2
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
91 ] |
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
92 |
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
93 |
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
94 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
|
95 if defaults is None: |
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
96 defaults = dict() |
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
97 options = dict() |
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
98 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
|
99 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
|
100 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
|
101 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
|
102 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
|
103 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
|
104 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
|
105 else: |
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
106 key = item |
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
107 converter = str |
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
108 try: |
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
109 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
|
110 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
|
111 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
|
112 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
|
113 else: |
bb98e728f25b
Allow default values for individual options to be passed to read_config_section.
Bernhard Herzog <bh@intevation.de>
parents:
234
diff
changeset
|
114 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
|
115 % (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
|
116 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
|
117 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
|
118 return options |
0 | 119 |
120 | |
121 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
|
122 """Reads the tree packager configuration from the file given by filename. |
0 | 123 |
115 | 124 The function returns a tuple with a dict ('treepkg') and a list of |
125 dicts ('packagers'). The treepkg dict contains the main | |
126 configuration of the tree packager. The packagers list contains one | |
127 dict with the configuratiin for each packager. | |
0 | 128 """ |
391
89ecca5d262e
check if config file exists to get usefull error output
Bjoern Ricks <bricks@intevation.de>
parents:
389
diff
changeset
|
129 if not os.path.exists(filename): |
89ecca5d262e
check if config file exists to get usefull error output
Bjoern Ricks <bricks@intevation.de>
parents:
389
diff
changeset
|
130 print >>sys.stderr, "Config file %s does not exist" % filename |
89ecca5d262e
check if config file exists to get usefull error output
Bjoern Ricks <bricks@intevation.de>
parents:
389
diff
changeset
|
131 sys.exit(2) |
258
bb98e728f25b
Allow default values for individual options to be passed to read_config_section.
Bernhard Herzog <bh@intevation.de>
parents:
234
diff
changeset
|
132 parser = SafeConfigParser() |
0 | 133 parser.read([filename]) |
2
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
134 |
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
135 # extract packager configurations |
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
136 packagers = [] |
0 | 137 for section in parser.sections(): |
138 if section.startswith("pkg_"): | |
114
02c261e4443f
Extend treepkg.readconfig.read_config:
Bernhard Herzog <bh@intevation.de>
parents:
93
diff
changeset
|
139 vars = dict(name=section[4:]) |
02c261e4443f
Extend treepkg.readconfig.read_config:
Bernhard Herzog <bh@intevation.de>
parents:
93
diff
changeset
|
140 packager_class = parser.get(section, "packager_class", vars=vars) |
02c261e4443f
Extend treepkg.readconfig.read_config:
Bernhard Herzog <bh@intevation.de>
parents:
93
diff
changeset
|
141 module = packager.import_packager_module(packager_class) |
52
78cf5f6778ec
Rename 'packagel ine' -> 'package track'
Bernhard Herzog <bh@intevation.de>
parents:
47
diff
changeset
|
142 desc = packager_desc + module.PackageTrack.extra_config_desc |
389
a690fc689f2f
added treepkg_dir andd tracks_dir attributes to PackageGroup
Bjoern Ricks <bricks@intevation.de>
parents:
387
diff
changeset
|
143 packager_options = read_config_section(parser, section, desc, |
a690fc689f2f
added treepkg_dir andd tracks_dir attributes to PackageGroup
Bjoern Ricks <bricks@intevation.de>
parents:
387
diff
changeset
|
144 defaults=vars) |
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
|
145 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
|
146 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
|
147 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
|
148 % (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
|
149 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
|
150 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
|
151 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
|
152 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
|
153 "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
|
154 % (section) |
389
a690fc689f2f
added treepkg_dir andd tracks_dir attributes to PackageGroup
Bjoern Ricks <bricks@intevation.de>
parents:
387
diff
changeset
|
155 packagers.append(packager_options) |
0 | 156 |
2
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
157 # main config |
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
158 treepkg = read_config_section(parser, "treepkg", treepkg_desc) |
0 | 159 |
2
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
160 return treepkg, packagers |
0 | 161 |
162 | |
163 if __name__ == "__main__": | |
2
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
164 import pprint |
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
165 print pprint.pprint(read_config(sys.argv[1])) |