_cmp use name if order is the same.
[bertos.git] / wizard / bertos_utils.py
index 465808aaf657fb26f28240a7e85f44083f6c93e2..e361b3c446ec5ebc212c1d7dee71a68b822ed912 100644 (file)
@@ -52,7 +52,13 @@ from _wizard_version import WIZARD_VERSION
 from LoadException import VersionException, ToolchainException
 
 def _cmp(x, y):
-    return cmp(x["info"].get('ord', 0), y["info"].get('ord', 0))
+    result = cmp(x["info"].get('ord', 0), y["info"].get('ord', 0))
+    if result == 0:
+        result = cmp(
+            x["info"].get("name", x["info"]["filename"]).lower(),
+            y["info"].get("name", y["info"]["filename"]).lower()
+        )
+    return result
 
 def isBertosDir(directory):
    return os.path.exists(directory + "/VERSION")