view artifacts/contrib/find-obsolete-i18n-strings.py @ 9713:aef987124822 3.2.x

Do not rely on database default for setting hws_lines.official to 0 It's not under the control of the importer whether the field is rendered into an INSERT statement, whether it's actually set or not. If it is unset but rendered into the statement, the field would be set to NULL. Thus, always set it explicitly. While here, remove an unused import.
author Tom Gottfried <tom@intevation.de>
date Fri, 12 Mar 2021 15:11:44 +0100
parents 26971f97105f
children
line wrap: on
line source
#!/usr/bin/env python

import os
import re
import sys

KEY_RE = re.compile(r"^\s*([^\s=]+)\s*=.*$")

def main():
    content = []
    for root, dirs, files in os.walk('.'):
        for f in files:
            if not (f.endswith(".java") or f.endswith(".xml")):
                continue
            p = os.path.join(root, f)
            with open(p, "rb") as jf:
                content.append(jf.read())

    content = ''.join(content)

    for arg in sys.argv[1:]:
        with open(arg, "rb") as prop:
            for line in prop:
                m = KEY_RE.match(line)
                if not m:
                    continue
                key = m.group(1)
                if content.find(key) == -1:
                    print key

if __name__ == "__main__":
    main()

http://dive4elements.wald.intevation.org