2
0

check_consistency.py 681 B

12345678910111213141516171819202122232425262728293031
  1. #!/usr/bin/env python
  2. # checks to make sure that glife.qproj is in sync with the location files
  3. import os
  4. import sys
  5. import re
  6. import io
  7. import xml.etree.ElementTree as ET
  8. import os.path
  9. # read the project xml file first
  10. tree = ET.parse('glife.qproj')
  11. root = tree.getroot()
  12. xml_locations = []
  13. os_locations = os.listdir("locations")
  14. print "Locations missing from ./locations/:"
  15. for location in root.iter('Location'):
  16. name = location.attrib['name'].replace("$","_")
  17. xml_locations.append(name)
  18. if name not in os_locations:
  19. print name
  20. print "Locations missing from .qproj:"
  21. for name in os_locations:
  22. if name not in xml_locations:
  23. print name