sascha@2625: #!/usr/bin/env python
sascha@2625: 
sascha@2625: import sys
sascha@2625: import re
sascha@2625: 
sascha@2625: SPLIT_RE = re.compile(r"^\s*([^=]+)=\s*(.*)\s*")
sascha@2625: 
sascha@2625: def load_properties_file(filename):
sascha@2625:     props = {}
sascha@2625:     with open(filename, "r") as f:
sascha@2625:         while True:
sascha@2625:             line = f.readline()
sascha@2625:             if not line: break
sascha@2625:             m = SPLIT_RE.match(line)
sascha@2625:             if not m: continue
sascha@2625:             k = m.group(1).strip()
sascha@2627:             v = m.group(2).strip()
sascha@2625:             if k in props:
sascha@2627:                 print >> sys.stderr, "'%s' found more than once in '%s'." % (
sascha@2625:                     k, filename)
sascha@2625:             else:
sascha@2625:                 props[k] = v
sascha@2625:     return props
sascha@2625: 
sascha@2625: def main():
sascha@2625: 
sascha@2625:     props = [(arg, load_properties_file(arg)) for arg in sys.argv[1:]]
sascha@2625: 
sascha@2625:     l = len(props)
sascha@2625: 
sascha@2625:     for i in range(0, l):
sascha@2625:         a = props[i][1]
sascha@2625:         for j in range(i+1, l):
sascha@2625:             b = props[j][1]
sascha@2625:             for k in a.iterkeys():
sascha@2625:                 if k not in b:
sascha@2625:                     print >> sys.stderr, "'%s' found in '%s' but not in '%s'." % (
sascha@2625:                         k, props[i][0], props[j][0])
sascha@2625:             for k in b.iterkeys():
sascha@2625:                 if k not in a:
sascha@2625:                     print >> sys.stderr, "'%s' found in '%s' but not in '%s'." % (
sascha@2625:                         k, props[j][0], props[i][0])
sascha@2625:         
sascha@2625: if __name__ == '__main__':
sascha@2625:     main()