Better handling of duplicate default

Currently, an error is raised if more than one default is defined.

When including another manifest, it is likely that a default has
been defined in both manifests.

Don't raise an error if all the defaults defined have the same
attributes.

Change-Id: I2603020687e2ba04c2c62c3268ee375279b34a08
Signed-off-by: Julien Campergue <julien.campergue@parrot.com>
This commit is contained in:
Julien Campergue 2013-10-09 14:38:46 +02:00
parent e76efdd7b3
commit 7487992bd3

View File

@ -51,6 +51,12 @@ class _Default(object):
sync_c = False sync_c = False
sync_s = False sync_s = False
def __eq__(self, other):
return self.__dict__ == other.__dict__
def __ne__(self, other):
return self.__dict__ != other.__dict__
class _XmlRemote(object): class _XmlRemote(object):
def __init__(self, def __init__(self,
name, name,
@ -422,11 +428,14 @@ class XmlManifest(object):
for node in itertools.chain(*node_list): for node in itertools.chain(*node_list):
if node.nodeName == 'default': if node.nodeName == 'default':
if self._default is not None: new_default = self._ParseDefault(node)
if self._default is None:
self._default = new_default
elif new_default != self._default:
raise ManifestParseError( raise ManifestParseError(
'duplicate default in %s' % 'duplicate default in %s' %
(self.manifestFile)) (self.manifestFile))
self._default = self._ParseDefault(node)
if self._default is None: if self._default is None:
self._default = _Default() self._default = _Default()