From 9a090a877dc403fc988bdd7f9609d857c33ac1a3 Mon Sep 17 00:00:00 2001
From: mleszczy <michal.leszczynski@cern.ch>
Date: Wed, 25 Mar 2020 08:36:19 +0000
Subject: [PATCH] Improvements to confTool diff option

- Now the diff option does not treat as different 'True' vs True.
- In case of different order in lists that fact is printed instead of printing diff of each of its elements
---
 Control/AthenaConfiguration/share/confTool.py | 24 ++++++++++++-------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/Control/AthenaConfiguration/share/confTool.py b/Control/AthenaConfiguration/share/confTool.py
index 5caffd92d0d..57b5e742d6d 100755
--- a/Control/AthenaConfiguration/share/confTool.py
+++ b/Control/AthenaConfiguration/share/confTool.py
@@ -247,7 +247,7 @@ def __compareComponent(compRef, compChk, prefix, args, component):
             if args.ignoreIrrelevant and chkVal in ignoreList:
                 continue
 
-            if chkVal == refVal:
+            if str(chkVal) == str(refVal):
                 if not args.printIdenticalPerParameter:
                     continue
                 diffmarker = ""
@@ -287,14 +287,21 @@ def __compareComponent(compRef, compChk, prefix, args, component):
                 "%s exists only in Chk : \033[94m %s \033[0m \033[91m<< !!!\033[0m"
                 % (prefix, str(diffChk))
             )
+
         if len(compRef) == len(compChk):
-            for i, (refVal, chkVal) in enumerate(zip(compRef, compChk)):
-                if refVal != chkVal:
-                    print(
-                        "%s : \033[92m %s \033[0m vs \033[94m %s \033[0m \033[91m<< at index %s !!!\033[0m"
-                        % (prefix, str(refVal), str(chkVal), str(i))
-                    )
-                    __compareComponent(refVal, chkVal, "\t" + prefix + ">> ", args, '')
+            if sorted(compRef) == sorted(compChk):
+                print(
+                    "%s : \033[91m ^^ Different order ^^ !!!\033[0m"
+                    % (prefix)
+                )
+            else:
+                for i, (refVal, chkVal) in enumerate(zip(compRef, compChk)):
+                    if refVal != chkVal:
+                        print(
+                            "%s : \033[92m %s \033[0m vs \033[94m %s \033[0m \033[91m<< at index %s !!!\033[0m"
+                            % (prefix, str(refVal), str(chkVal), str(i))
+                        )
+                        __compareComponent(refVal, chkVal, "\t" + prefix + ">> ", args, '')
 
 
 def __parseIOVDbFolder(definition):
@@ -328,6 +335,7 @@ def __parseIOVDbFolder(definition):
 
     return json.dumps(result)
 
+
 def __compareIOVDbFolders(compRef, compChk, prefix, args):
     refParsed = []
     chkParsed = []
-- 
GitLab