check_get_file_list.py 921 B

12345678910111213141516171819202122232425262728293031
  1. #!/usr/bin/env python
  2. import os, sys
  3. from pathlib import Path
  4. sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", ".."))
  5. from binding_generator import get_file_list, generate_bindings
  6. api_filepath = "gdextension/extension_api.json"
  7. bits = "64"
  8. precision = "single"
  9. output_dir = "self_test"
  10. generate_bindings(api_filepath, use_template_get_node=False, bits=bits, precision=precision, output_dir=output_dir)
  11. flist = get_file_list(api_filepath, output_dir, headers=True, sources=True)
  12. p = Path(output_dir) / "gen"
  13. allfiles = [str(f.as_posix()) for f in p.glob("**/*.*")]
  14. missing = list(filter((lambda f: f not in flist), allfiles))
  15. extras = list(filter((lambda f: f not in allfiles), flist))
  16. if len(missing) > 0 or len(extras) > 0:
  17. print("Error!")
  18. for f in missing:
  19. print("MISSING: " + str(f))
  20. for f in extras:
  21. print("EXTRA: " + str(f))
  22. sys.exit(1)
  23. else:
  24. print("OK!")