Mercurial > treepkg > treepkg
comparison 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 |
comparison
equal
deleted
inserted
replaced
390:6cab748288f7 | 391:89ecca5d262e |
---|---|
7 | 7 |
8 """Reads the configuration file""" | 8 """Reads the configuration file""" |
9 | 9 |
10 import sys | 10 import sys |
11 import shlex | 11 import shlex |
12 import os.path | |
12 from ConfigParser import SafeConfigParser, NoOptionError | 13 from ConfigParser import SafeConfigParser, NoOptionError |
13 | 14 |
14 import util | 15 import util |
15 import packager | 16 import packager |
16 | 17 |
123 The function returns a tuple with a dict ('treepkg') and a list of | 124 The function returns a tuple with a dict ('treepkg') and a list of |
124 dicts ('packagers'). The treepkg dict contains the main | 125 dicts ('packagers'). The treepkg dict contains the main |
125 configuration of the tree packager. The packagers list contains one | 126 configuration of the tree packager. The packagers list contains one |
126 dict with the configuratiin for each packager. | 127 dict with the configuratiin for each packager. |
127 """ | 128 """ |
129 if not os.path.exists(filename): | |
130 print >>sys.stderr, "Config file %s does not exist" % filename | |
131 sys.exit(2) | |
128 parser = SafeConfigParser() | 132 parser = SafeConfigParser() |
129 parser.read([filename]) | 133 parser.read([filename]) |
130 | 134 |
131 # extract packager configurations | 135 # extract packager configurations |
132 packagers = [] | 136 packagers = [] |