view artifacts/contrib/find-obsolete-java-files.py @ 8195:67b663ed0496

Anti programming: Removed TIM parser which ist not needed any longer.
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 05 Sep 2014 10:09:16 +0200
parents adbf980004c0
children f799db6b1219
line wrap: on
line source
#!/usr/bin/env python

import os

def main():
    cnames = []
    for root, _, 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 = jf.read()
            if f.endswith('.xml'):
                cnames.append(('', content, p))
            else:
                cname = f[0:-5]
                cnames.append((cname, content, p))

    for i in range(len(cnames)):
        x = cnames[i]
        cname = x[0]
        if cname == '':
            continue
        found = False
        for j in range(len(cnames)):
            if i == j:
                continue
            if cnames[j][1].find(cname) >= 0:
                found = True
                break
        if not found:
            print cname, x[2]


if __name__ == "__main__":
    main()

http://dive4elements.wald.intevation.org