diff options
author | Chris Johns <chrisj@rtems.org> | 2013-04-13 18:29:30 +1000 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2013-04-13 18:29:30 +1000 |
commit | 0565e1fa4b7a67ee13626fcdc65c5c3f35975247 (patch) | |
tree | 698924b74be7267e849a66d78ed0a3c103c4a7e8 /source-builder/sb/config.py | |
parent | Fix options bug when the macro file is not found. (diff) | |
download | rtems-source-builder-0565e1fa4b7a67ee13626fcdc65c5c3f35975247.tar.bz2 |
Add support for snapshot testing.
User macro files passed on the command line allow a user to
override the defaults in configuration files to test new changes
in pending releases.
Fix macros issues with keys with more than one map.
Diffstat (limited to 'source-builder/sb/config.py')
-rw-r--r-- | source-builder/sb/config.py | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/source-builder/sb/config.py b/source-builder/sb/config.py index 43e28cd..a41a37c 100644 --- a/source-builder/sb/config.py +++ b/source-builder/sb/config.py @@ -103,42 +103,40 @@ class package: self.config.macros[info] = '\n'.join(self.infos[info]) def get_info(self, info, expand = True): - if info in self.infos: + if info in self.config.macros: + _info = self.config.macros[info].split('\n') if expand: - return self.config.expand(self.infos[info]) + return self.config.expand(_info) else: - return self.infos[info] + return _info return None def extract_info(self, label, expand = True): + ll = label.lower() infos = {} - for i in self.infos: - il = i.lower() - if il.startswith(label): - if il == label: - il = label + '0' - elif not il[len(label):].isdigit(): - continue - infos[il] = self.config.expand(self.infos[i]) + keys = self.config.macros.find('%s.*' % (ll)) + for k in keys: + if k == ll: + k = '%s0' % (ll) + elif not k[len(ll):].isdigit(): + continue + infos[k] = [self.config.expand(self.config.macros[k])] return infos - def find_info(self, label, expand = True): - for i in self.infos: - if i.lower() == label: - if expand: - return self.config.expand(self.infos[i]) - else: - return self.infos[i] + def _find_macro(self, label, expand = True): + if label in self.config.macros: + macro = self.config.macros[label].split('\n') + if expand: + return self.config.expand(macro) + else: + return macro return None + def find_info(self, label, expand = True): + return self._find_macro(label, expand) + def find_directive(self, label, expand = True): - for d in self.directives: - if d.lower() == label: - if expand: - return self.config.expand(self.directives[d]) - else: - return self.directives[d] - return None + return self._find_macro(label, expand) def name(self): info = self.find_info('name') |