suite/locales/filter.py
author Jorg K <jorgk@jorgk.com>
Thu, 12 Apr 2018 21:51:55 +0200
changeset 30531 e7b1d8cd4f3bf56febb93ed1ae0ae8a884d84848
parent 29363 b27be9c6a171c25242d0deb8348ea4763df41d5c
child 31214 ea4c0d8fc22e6c2b705e8009fdf8e8d99de71fe6
permissions -rw-r--r--
Bug 1452764 - Bug 1444601 follow-up: Restore bundle_read_smime so S/MIME decryption feedback shows again. a=jorgk DONTBUILD

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

def test(mod, path, entity=None):
  import re
  # ignore anything but SeaMonkey
  if mod not in ("netwerk", "dom", "toolkit", "security/manager",
                 "devtools/client", "devtools/shared", "devtools/shim",
                 "editor/ui", "suite", "services/sync"):
    return "ignore"
  # ignore temporary files, hiden files and files from rejects
  if (re.match(r".*?\/[.#].+", path) or
      re.match(r".*~$", path) or
      re.match(r".+\.(orig|rej)", path)):
    return "ignore"
  if mod not in ("suite"):
    # we only have exceptions for suite
    return "error"
  if entity is None:
    # missing and obsolete files
    return ("ignore" if (re.match(r"searchplugins\/.+\.xml", path) or
                         path == "profile/bookmarks.extra" or
                         path == "profile/panels.extra" or
                         path == "defines.inc" or
                         path == "suite-l10n.js" or
                         re.match(r"chrome\/common\/help\/images\/[A-Za-z-_]+\.[a-z]+", path))
            else "error")
  if path == "defines.inc":
    return ("ignore" if (entity == "MOZ_LANGPACK_CONTRIBUTORS")
            else "error")

  if path == "chrome/common/region.properties":
    return ("ignore" if (re.match(r"browser\.search\.order\.[1-9]", entity))
            else "error")

  if path != "chrome/browser/region.properties":
    # only region.properties exceptions remain, compare all others
    return "error"

  return ("ignore"
          if (re.match(r"browser\.contentHandlers\.types\.[0-5]", entity))
          else "error")