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.
This commit is contained in:
Axel Hecht 2013-09-11 14:12:05 +02:00
parent 4ea05759af
commit 9dde61071d

View File

@ -11,27 +11,32 @@ def test(mod, path, entity = None):
"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"