def get_config_dict(self): """Return the best matching easyconfig dict""" self.log.experimental(self.__class__.__name__) # the toolchain name/version should not be specified in the pyheader, # but other toolchain options are allowed cfg = copy.deepcopy(self.pyheader_localvars) self.log.debug("Config dict based on Python header: %s" % cfg) co = EBConfigObj(self.configobj) version = self.specs.get('version', None) tc_spec = self.specs.get('toolchain', {}) toolchain_name = tc_spec.get('name', None) toolchain_version = tc_spec.get('version', None) # parse and interpret, dealing with defaults etc version, tcname, tcversion = co.get_version_toolchain( version, toolchain_name, toolchain_version) # format 2.0 will squash self.log.debug('Squashing with version %s and toolchain %s' % (version, (tcname, tcversion))) res = co.squash(version, tcname, tcversion) cfg.update(res) self.log.debug( "Config dict after processing applicable easyconfig sections: %s" % cfg) # FIXME what about updating dict values/appending to list values? # FIXME how do we allow both redefining and updating? = and +=? # update config with correct version/toolchain (to avoid using values specified in default section) cfg.update({ 'version': version, 'toolchain': { 'name': tcname, 'version': tcversion }, }) self.log.debug( "Final config dict (including correct version/toolchain): %s" % cfg) return cfg
def get_config_dict(self): """Return the best matching easyconfig dict""" self.log.experimental(self.__class__.__name__) # the toolchain name/version should not be specified in the pyheader, # but other toolchain options are allowed cfg = copy.deepcopy(self.pyheader_localvars) self.log.debug("Config dict based on Python header: %s" % cfg) co = EBConfigObj(self.configobj) version = self.specs.get('version', None) tc_spec = self.specs.get('toolchain', {}) toolchain_name = tc_spec.get('name', None) toolchain_version = tc_spec.get('version', None) # parse and interpret, dealing with defaults etc version, tcname, tcversion = co.get_version_toolchain(version, toolchain_name, toolchain_version) # format 2.0 will squash self.log.debug('Squashing with version %s and toolchain %s' % (version, (tcname, tcversion))) res = co.squash(version, tcname, tcversion) cfg.update(res) self.log.debug("Config dict after processing applicable easyconfig sections: %s" % cfg) # FIXME what about updating dict values/appending to list values? # FIXME how do we allow both redefining and updating? = and +=? # update config with correct version/toolchain (to avoid using values specified in default section) cfg.update({ 'version': version, 'toolchain': {'name': tcname, 'version': tcversion}, }) self.log.debug("Final config dict (including correct version/toolchain): %s" % cfg) return cfg