browser/locales/filter.py

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/locales/filter.py	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,42 @@
     1.4 +# This Source Code Form is subject to the terms of the Mozilla Public
     1.5 +# License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 +# file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.7 +
     1.8 +def test(mod, path, entity = None):
     1.9 +  import re
    1.10 +  # ignore anything but Firefox
    1.11 +  if mod not in ("netwerk", "dom", "toolkit", "security/manager",
    1.12 +                 "browser", "browser/metro", "webapprt",
    1.13 +                 "extensions/reporter", "extensions/spellcheck",
    1.14 +                 "other-licenses/branding/firefox",
    1.15 +                 "browser/branding/official",
    1.16 +                 "services/sync"):
    1.17 +    return "ignore"
    1.18 +  if mod not in ("browser", "browser/metro", "extensions/spellcheck"):
    1.19 +    # we only have exceptions for browser, metro and extensions/spellcheck
    1.20 +    return "error"
    1.21 +  if not entity:
    1.22 +    # the only files to ignore are spell checkers and search
    1.23 +    if mod == "extensions/spellcheck":
    1.24 +      return "ignore"
    1.25 +    # browser
    1.26 +    return "ignore" if re.match(r"searchplugins\/.+\.xml", path) else "error"
    1.27 +  if mod == "extensions/spellcheck":
    1.28 +    # l10n ships en-US dictionary or something, do compare
    1.29 +    return "error"
    1.30 +  if path == "defines.inc":
    1.31 +    return "ignore" if entity == "MOZ_LANGPACK_CONTRIBUTORS" else "error"
    1.32 +
    1.33 +  if mod == "browser" and path == "chrome/browser-region/region.properties":
    1.34 +    # only region.properties exceptions remain, compare all others
    1.35 +    return ("ignore"
    1.36 +            if (re.match(r"browser\.search\.order\.[1-9]", entity) or
    1.37 +                re.match(r"browser\.contentHandlers\.types\.[0-5]", entity) or
    1.38 +                re.match(r"gecko\.handlerService\.schemes\.", entity) or
    1.39 +                re.match(r"gecko\.handlerService\.defaultHandlersVersion", entity))
    1.40 +            else "error")
    1.41 +  if mod == "browser/metro" and path == "chrome/region.properties":
    1.42 +      return ("ignore"
    1.43 +              if re.match(r"browser\.search\.order\.[1-9]", entity)
    1.44 +              else "error")
    1.45 +  return "error"

mercurial