mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-09-29 16:10:24 +09:00
dtoc: Convert the Fdt.Node class to Python 3
Update this class to work correctly on Python 3 and to pass its unit tests. The only required change is to deal with a difference in the behaviour of sorting with a None value. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
928527f686
commit
635180538e
@ -465,8 +465,11 @@ class Node:
|
||||
|
||||
# Sync properties now, whose offsets should not have been disturbed.
|
||||
# We do this after subnodes, since this disturbs the offsets of these
|
||||
# properties.
|
||||
prop_list = sorted(self.props.values(), key=lambda prop: prop._offset,
|
||||
# properties. Note that new properties will have an offset of None here,
|
||||
# which Python 3 cannot sort against int. So use a large value instead
|
||||
# to ensure that the new properties are added first.
|
||||
prop_list = sorted(self.props.values(),
|
||||
key=lambda prop: prop._offset or 1 << 31,
|
||||
reverse=True)
|
||||
for prop in prop_list:
|
||||
prop.Sync(auto_resize)
|
||||
|
Loading…
Reference in New Issue
Block a user