eSpeak NG is an open source speech synthesizer that supports more than hundred languages and accents.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

windows-data.test 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/usr/bin/env python3
  2. import sys
  3. import os
  4. import xml.etree.ElementTree as etree
  5. passed = True
  6. def check_result(check, message):
  7. global passed
  8. if check:
  9. print('passed')
  10. elif message:
  11. print('failed: ' + message)
  12. passed = False
  13. else:
  14. print('failed')
  15. passed = False
  16. def check_missing(items, target):
  17. missing = []
  18. for item in items:
  19. if not item in target:
  20. missing.append(item)
  21. check_result(len(missing) == 0, ', '.join(missing))
  22. return missing
  23. def all_descendants(proj, name):
  24. for e in proj.iter():
  25. if e.tag == '{http://schemas.microsoft.com/developer/msbuild/2003}' + name:
  26. yield e
  27. def children(e, name):
  28. for c in e:
  29. if not isinstance(c, str):
  30. if c.tag == '{http://schemas.microsoft.com/developer/msbuild/2003}' + name:
  31. yield c
  32. def element_map(proj, name):
  33. print('testing for duplicate \'' + name + '\' names ... ', end='')
  34. items = {}
  35. duplicates = []
  36. for e in all_descendants(proj, name):
  37. id = e.attrib.get("Name")
  38. if id in items.keys():
  39. duplicates.append(id)
  40. else:
  41. items[id] = e
  42. check_result(len(duplicates) == 0 , ', '.join(duplicates))
  43. return items
  44. def list_dictionaries():
  45. for file in os.listdir('dictsource'):
  46. if file.endswith('_rules'):
  47. yield file.split('_')[0]
  48. # 1. Check for missing/duplicate names #################################################################################
  49. proj = etree.parse('src/windows/data.vcxproj').getroot()
  50. targets = element_map(proj, 'Target')
  51. # 2. Check for missing dictionaries ####################################################################################
  52. dictionaries = list(list_dictionaries())
  53. depends_on_dictionaries = targets['Dictionaries'].attrib.get('DependsOnTargets').split(';')
  54. print('testing for missing dictionary targets ... ', end='')
  55. check_missing(depends_on_dictionaries, targets.keys())
  56. print('testing for missing dependencies on dictionaries ... ', end='')
  57. check_missing(set.intersection(set(dictionaries), set(targets.keys())), depends_on_dictionaries)
  58. ########################################################################################################################
  59. if not passed:
  60. sys.exit(-1)