bug 907146, update filter.py for metro, f=flod
authorAxel Hecht <axel@pike.org>
Wed, 11 Sep 2013 14:12:05 +0200
changeset 146552 7dd0ddad04601d33a36d1ccc9d7740abcc642952
parent 146551 e6a358389a6064b454e373324fe933f9fe16de3b
child 146553 42a4dec61095504a0287a80741e6a5dfb83e5b9a
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
bugs907146
milestone26.0a1
bug 907146, update filter.py for metro, f=flod I also reworked the python code to be easier to read, and use string return values instead of bools.
browser/locales/filter.py
--- a/browser/locales/filter.py
+++ b/browser/locales/filter.py
@@ -6,32 +6,37 @@ def test(mod, path, entity = None):
   import re
   # ignore anything but Firefox
   if mod not in ("netwerk", "dom", "toolkit", "security/manager",
                  "browser", "browser/metro", "webapprt",
                  "extensions/reporter", "extensions/spellcheck",
                  "other-licenses/branding/firefox",
                  "browser/branding/official",
                  "services/sync"):
-    return False
-  if mod != "browser" and mod != "extensions/spellcheck":
-    # we only have exceptions for browser and extensions/spellcheck
-    return True
+    return "ignore"
+  if mod not in ("browser", "browser/metro", "extensions/spellcheck"):
+    # we only have exceptions for browser, metro and extensions/spellcheck
+    return "error"
   if not entity:
+    # the only files to ignore are spell checkers and search
     if mod == "extensions/spellcheck":
-      return False
+      return "ignore"
     # browser
-    return not (re.match(r"searchplugins\/.+\.xml", path) or
-                re.match(r"chrome\/help\/images\/[A-Za-z-_]+\.png", path))
+    return "ignore" if re.match(r"searchplugins\/.+\.xml", path) else "error"
   if mod == "extensions/spellcheck":
     # l10n ships en-US dictionary or something, do compare
-    return True
+    return "error"
   if path == "defines.inc":
-    return entity != "MOZ_LANGPACK_CONTRIBUTORS"
+    return "ignore" if entity == "MOZ_LANGPACK_CONTRIBUTORS" else "error"
 
-  if path != "chrome/browser-region/region.properties":
+  if mod == "browser" and path == "chrome/browser-region/region.properties":
     # only region.properties exceptions remain, compare all others
-    return True
-  
-  return not (re.match(r"browser\.search\.order\.[1-9]", entity) or
-              re.match(r"browser\.contentHandlers\.types\.[0-5]", entity) or
-              re.match(r"gecko\.handlerService\.schemes\.", entity) or
-              re.match(r"gecko\.handlerService\.defaultHandlersVersion", entity))
+    return ("ignore"
+            if (re.match(r"browser\.search\.order\.[1-9]", entity) or
+                re.match(r"browser\.contentHandlers\.types\.[0-5]", entity) or
+                re.match(r"gecko\.handlerService\.schemes\.", entity) or
+                re.match(r"gecko\.handlerService\.defaultHandlersVersion", entity))
+            else "error")
+  if mod == "browser/metro" and path == "chrome/region.properties":
+      return ("ignore"
+              if re.match(r"browser\.search\.order\.[1-9]", entity)
+              else "error")
+  return "error"