Prettify the output of the override-feature-defines script
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Jan 2013 21:23:41 +0000 (21:23 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Jan 2013 21:23:41 +0000 (21:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=106542

Patch by Zan Dobersek <zandobersek@gmail.com> on 2013-01-22
Reviewed by Martin Robinson.

The output now clearly lists the feature defines being overridden
along with the default and overriding values for each feature define.

* gtk/override-feature-defines:
(adjust_feature_defines_makefile):
(adjust_feature_defines_makefile.override_feature_define):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@140458 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/gtk/override-feature-defines

index b99de12065aeffb3cf1ba1bb8fca9b7392802874..2142f00fd0c19e79de24e150bc1278e8a0b10020 100644 (file)
@@ -1,3 +1,17 @@
+2013-01-22  Zan Dobersek  <zandobersek@gmail.com>
+
+        Prettify the output of the override-feature-defines script
+        https://bugs.webkit.org/show_bug.cgi?id=106542
+
+        Reviewed by Martin Robinson.
+
+        The output now clearly lists the feature defines being overridden
+        along with the default and overriding values for each feature define.
+
+        * gtk/override-feature-defines:
+        (adjust_feature_defines_makefile):
+        (adjust_feature_defines_makefile.override_feature_define):
+
 2013-01-22  Zan Dobersek  <zdobersek@igalia.com>
 
         Remove uses of deprecated unittest.TestCase aliases
 2013-01-22  Zan Dobersek  <zdobersek@igalia.com>
 
         Remove uses of deprecated unittest.TestCase aliases
index 258b8e5a3ebf4b0102822b128c9c5158326b65bd..6b09ece86c2a5fd565215986d9006a189fd767d4 100755 (executable)
@@ -15,22 +15,26 @@ def adjust_feature_defines_makefile(build_dir, feature_defines_overriding):
     with open(feature_defines_makefile_file) as f:
         feature_defines_makefile = f.read()
 
     with open(feature_defines_makefile_file) as f:
         feature_defines_makefile = f.read()
 
-    overriden_feature_defines = []
+    overridden_feature_defines = {}
     def override_feature_define(match):
     def override_feature_define(match):
-        matched_feature_define = match.group('feature')
-        if matched_feature_define not in feature_defines_overriding:
+        feature_define = match.group('feature')
+        if feature_define not in feature_defines_overriding:
             return match.string[match.start():match.end()]
 
             return match.string[match.start():match.end()]
 
-        if int(match.group('default_value')) is not feature_defines_overriding[matched_feature_define]:
-            overriden_feature_defines.append(matched_feature_define)
-        return "%s=%d" % (matched_feature_define, feature_defines_overriding[matched_feature_define])
+        default_value = int(match.group('default_value'))
+        overriding_value = feature_defines_overriding[feature_define]
+        if default_value is not overriding_value:
+            overridden_feature_defines[feature_define] = default_value, overriding_value
+        return "%s=%d" % (feature_define, overriding_value)
 
     feature_defines_makefile = re.sub(r"(?P<feature>(?:ENABLE_)\w+)=(?P<default_value>0|1)", override_feature_define, feature_defines_makefile)
     with open(feature_defines_makefile_file, 'w') as f:
         f.write(feature_defines_makefile)
 
 
     feature_defines_makefile = re.sub(r"(?P<feature>(?:ENABLE_)\w+)=(?P<default_value>0|1)", override_feature_define, feature_defines_makefile)
     with open(feature_defines_makefile_file, 'w') as f:
         f.write(feature_defines_makefile)
 
-    if overriden_feature_defines:
-        print("The following feature defines were overriden:\n{0}".format(', '.join(overriden_feature_defines)))
+    if overridden_feature_defines:
+        print("The following feature defines were overriden:")
+        for feature, values in iter(overridden_feature_defines.items()):
+            print("\t{0}: {1} => {2}".format(feature, *values))
 
 def override_feature_defines(build_dir):
     copy_feature_defines_makefile()
 
 def override_feature_defines(build_dir):
     copy_feature_defines_makefile()