mirror of
https://xff.cz/git/u-boot/
synced 2025-09-02 01:02:19 +02:00
binman: Avoid changing a dict during iteration
This code works OK in Python 2 but Python 3 complains. Adjust it to avoid deleting elements from a dict while iterating through it. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -131,10 +131,13 @@ def Binman(options, args):
|
|||||||
|
|
||||||
if options.image:
|
if options.image:
|
||||||
skip = []
|
skip = []
|
||||||
|
new_images = OrderedDict()
|
||||||
for name, image in images.items():
|
for name, image in images.items():
|
||||||
if name not in options.image:
|
if name in options.image:
|
||||||
del images[name]
|
new_images[name] = image
|
||||||
|
else:
|
||||||
skip.append(name)
|
skip.append(name)
|
||||||
|
images = new_images
|
||||||
if skip and options.verbosity >= 2:
|
if skip and options.verbosity >= 2:
|
||||||
print('Skipping images: %s' % ', '.join(skip))
|
print('Skipping images: %s' % ', '.join(skip))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user