manifest: Serialize remote[url-base] properly

Since the python object is named url_base, this field is getting
frozen via as_dict with an underscore rather than the dash required
by the schema.

Signed-off-by: Andy Doan <andy@foundries.io>
This commit is contained in:
Andy Doan 2019-02-13 15:40:19 -06:00 committed by Marti Bolivar
parent 5d30c9c93b
commit ab560b5c64
2 changed files with 3 additions and 3 deletions

View File

@ -359,14 +359,14 @@ class Remote:
return self.name == other.name and self.url_base == other.url_base return self.name == other.name and self.url_base == other.url_base
def __repr__(self): def __repr__(self):
return 'Remote(name={}, url_base={})'.format(repr(self.name), return 'Remote(name={}, url-base={})'.format(repr(self.name),
repr(self.url_base)) repr(self.url_base))
def as_dict(self): def as_dict(self):
'''Return a representation of this object as a dict, as it would be '''Return a representation of this object as a dict, as it would be
parsed from an equivalent YAML manifest.''' parsed from an equivalent YAML manifest.'''
return collections.OrderedDict( return collections.OrderedDict(
((s, getattr(self, s)) for s in self.__slots__)) ((s.replace('_', '-'), getattr(self, s)) for s in self.__slots__))
class Project: class Project:

View File

@ -266,7 +266,7 @@ def test_manifest_freeze(west_update_tmpdir):
'^ revision: master$', '^ revision: master$',
'^ remotes:$', '^ remotes:$',
'^ - name: test-local$', '^ - name: test-local$',
'^ url_base: .*$', '^ url-base: .*$',
'^ projects:$', '^ projects:$',
'^ - name: Kconfiglib$', '^ - name: Kconfiglib$',
'^ remote: test-local$', '^ remote: test-local$',