comparison 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
comparison
equal deleted inserted replaced
388:1af04bfbb1d0 389:a690fc689f2f
82 ] 82 ]
83 83
84 treepkg_desc = [ 84 treepkg_desc = [
85 ("check_interval", int), 85 ("check_interval", int),
86 "instructions_file", 86 "instructions_file",
87 ("name", str, "") 87 ("name", str, ""),
88 ("treepkg_dir", str, None),
89 ("tracks_dir", str, None)
88 ] 90 ]
89 91
90 92
91 def read_config_section(parser, section, item_desc, defaults=None): 93 def read_config_section(parser, section, item_desc, defaults=None):
92 if defaults is None: 94 if defaults is None:
132 if section.startswith("pkg_"): 134 if section.startswith("pkg_"):
133 vars = dict(name=section[4:]) 135 vars = dict(name=section[4:])
134 packager_class = parser.get(section, "packager_class", vars=vars) 136 packager_class = parser.get(section, "packager_class", vars=vars)
135 module = packager.import_packager_module(packager_class) 137 module = packager.import_packager_module(packager_class)
136 desc = packager_desc + module.PackageTrack.extra_config_desc 138 desc = packager_desc + module.PackageTrack.extra_config_desc
137 packager_options = (read_config_section(parser, section, desc, 139 packager_options = read_config_section(parser, section, desc,
138 defaults=vars)) 140 defaults=vars)
139 if not packager_options.get("svn_url") \ 141 if not packager_options.get("svn_url") \
140 and not packager_options.get('git_url'): 142 and not packager_options.get('git_url'):
141 print >>sys.stderr, "Missing repository URL in section %r" \ 143 print >>sys.stderr, "Missing repository URL in section %r" \
142 % (section) 144 % (section)
143 sys.exit(1) 145 sys.exit(1)
144 elif packager_options.get("svn_url") \ 146 elif packager_options.get("svn_url") \
145 and packager_options.get('git_url'): 147 and packager_options.get('git_url'):
146 print >>sys.stderr, \ 148 print >>sys.stderr, \
147 "Warning: git_url in section %r will be ignored" \ 149 "Warning: git_url in section %r will be ignored" \
148 % (section) 150 % (section)
149 packagers.append(read_config_section(parser, section, desc, 151 packagers.append(packager_options)
150 defaults=vars))
151 152
152 # main config 153 # main config
153 treepkg = read_config_section(parser, "treepkg", treepkg_desc) 154 treepkg = read_config_section(parser, "treepkg", treepkg_desc)
154 155
155 return treepkg, packagers 156 return treepkg, packagers
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)