Mercurial > treepkg > treepkg
annotate treepkg/readconfig.py @ 389:a690fc689f2f treepkg-status
added treepkg_dir andd tracks_dir attributes to PackageGroup
author | Bjoern Ricks <bricks@intevation.de> |
---|---|
date | Thu, 08 Jul 2010 15:59:52 +0000 |
parents | c1f3be727f9d |
children | 89ecca5d262e |
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 |
0 | 12 from ConfigParser import SafeConfigParser, NoOptionError |
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 | 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", |
389
a690fc689f2f
added treepkg_dir andd tracks_dir attributes to PackageGroup
Bjoern Ricks <bricks@intevation.de>
parents:
387
diff
changeset
|
87 ("name", str, ""), |
a690fc689f2f
added treepkg_dir andd tracks_dir attributes to PackageGroup
Bjoern Ricks <bricks@intevation.de>
parents:
387
diff
changeset
|
88 ("treepkg_dir", str, None), |
a690fc689f2f
added treepkg_dir andd tracks_dir attributes to PackageGroup
Bjoern Ricks <bricks@intevation.de>
parents:
387
diff
changeset
|
89 ("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
|
90 ] |
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 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
|
94 if defaults is None: |
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
95 defaults = dict() |
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
96 options = dict() |
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
97 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
|
98 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
|
99 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
|
100 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
|
101 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
|
102 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
|
103 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
|
104 else: |
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
105 key = item |
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
106 converter = str |
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
107 try: |
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
108 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
|
109 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
|
110 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
|
111 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
|
112 else: |
bb98e728f25b
Allow default values for individual options to be passed to read_config_section.
Bernhard Herzog <bh@intevation.de>
parents:
234
diff
changeset
|
113 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
|
114 % (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
|
115 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
|
116 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
|
117 return options |
0 | 118 |
119 | |
120 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
|
121 """Reads the tree packager configuration from the file given by filename. |
0 | 122 |
115 | 123 The function returns a tuple with a dict ('treepkg') and a list of |
124 dicts ('packagers'). The treepkg dict contains the main | |
125 configuration of the tree packager. The packagers list contains one | |
126 dict with the configuratiin for each packager. | |
0 | 127 """ |
258
bb98e728f25b
Allow default values for individual options to be passed to read_config_section.
Bernhard Herzog <bh@intevation.de>
parents:
234
diff
changeset
|
128 parser = SafeConfigParser() |
0 | 129 parser.read([filename]) |
2
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
130 |
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
131 # extract packager configurations |
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
132 packagers = [] |
0 | 133 for section in parser.sections(): |
134 if section.startswith("pkg_"): | |
114
02c261e4443f
Extend treepkg.readconfig.read_config:
Bernhard Herzog <bh@intevation.de>
parents:
93
diff
changeset
|
135 vars = dict(name=section[4:]) |
02c261e4443f
Extend treepkg.readconfig.read_config:
Bernhard Herzog <bh@intevation.de>
parents:
93
diff
changeset
|
136 packager_class = parser.get(section, "packager_class", vars=vars) |
02c261e4443f
Extend treepkg.readconfig.read_config:
Bernhard Herzog <bh@intevation.de>
parents:
93
diff
changeset
|
137 module = packager.import_packager_module(packager_class) |
52
78cf5f6778ec
Rename 'packagel ine' -> 'package track'
Bernhard Herzog <bh@intevation.de>
parents:
47
diff
changeset
|
138 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
|
139 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
|
140 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
|
141 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
|
142 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
|
143 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
|
144 % (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
|
145 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
|
146 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
|
147 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
|
148 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
|
149 "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
|
150 % (section) |
389
a690fc689f2f
added treepkg_dir andd tracks_dir attributes to PackageGroup
Bjoern Ricks <bricks@intevation.de>
parents:
387
diff
changeset
|
151 packagers.append(packager_options) |
0 | 152 |
2
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
153 # main config |
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
154 treepkg = read_config_section(parser, "treepkg", treepkg_desc) |
0 | 155 |
2
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
156 return treepkg, packagers |
0 | 157 |
158 | |
159 if __name__ == "__main__": | |
2
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
160 import pprint |
e6a9f4037f68
readconfig.py is smarter now about conversions and supports shlex
Bernhard Herzog <bh@intevation.de>
parents:
0
diff
changeset
|
161 print pprint.pprint(read_config(sys.argv[1])) |