view artifacts/contrib/find-obsolete-i18n-strings.py @ 8452:b9a8463ac636

(issue1732) When duplication wsplgen artificats fix shapefile layers The shapefile layers are copied but still contained the old names and paths and the wms layer refered to layers from the old artifact. This was broken. Now the old artificat id is replaced by the new artifact id in the mapfiles. Duplication most wsplgen artifacts should now work.
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 28 Oct 2014 18:52:35 +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