diff mbox series

[v2,4/6] python3: no need to use an OrderedDict

Message ID 20261111141726.1496785-4-ross.burton@arm.com
State New
Headers show
Series [v2,1/6] python3: remove obsolete reformatting of _sysconfigdata*.py | expand

Commit Message

Ross Burton Nov. 11, 2026, 2:17 p.m. UTC
As of Python 3.7, standard dictionaries are sorted by insertion order.
As this stable order was the only reason for using OrderedDict, we can
switch to using a normal dictionary.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/recipes-devtools/python/python3/create_manifest3.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/meta/recipes-devtools/python/python3/create_manifest3.py b/meta/recipes-devtools/python/python3/create_manifest3.py
index 5dda382de8f..029d9235c1a 100644
--- a/meta/recipes-devtools/python/python3/create_manifest3.py
+++ b/meta/recipes-devtools/python/python3/create_manifest3.py
@@ -37,7 +37,6 @@  import sys
 import subprocess
 import json
 import os
-import collections
 
 if '-d' in sys.argv:
     debugFlag = '-d'
@@ -54,7 +53,7 @@  for p in sys.path:
         nativelibfolder = p[:p.find(pivot)+len(pivot)]
 
 # Empty dict to hold the whole manifest
-new_manifest = collections.OrderedDict()
+new_manifest = {}
 
 # Check for repeated files, folders and wildcards
 allfiles = []
@@ -91,7 +90,7 @@  with open('python3-manifest.json') as manifest:
     manifest.seek(0)
     comments = manifest.read(json_start)
     manifest_str = manifest.read()
-    old_manifest = json.loads(manifest_str, object_pairs_hook=collections.OrderedDict)
+    old_manifest = json.loads(manifest_str)
 
 #
 # First pass to get core-package functionality, because we base everything on the fact that core is actually working
@@ -195,7 +194,7 @@  for pypkg in old_manifest:
 
 for pypkg in old_manifest:
     # Use an empty dict as data structure to hold data for each package and fill it up
-    new_manifest[pypkg] = collections.OrderedDict()
+    new_manifest[pypkg] = {}
     new_manifest[pypkg]['summary'] = old_manifest[pypkg]['summary']
     new_manifest[pypkg]['rdepends'] = []
     new_manifest[pypkg]['files'] = []