modules_builders.py 681 B

12345678910111213141516171819202122232425
  1. """Functions used to generate source files during build time
  2. All such functions are invoked in a subprocess on Windows to prevent build flakiness.
  3. """
  4. from platform_methods import subprocess_main
  5. def generate_modules_enabled(target, source, env):
  6. with open(target[0].path, "w") as f:
  7. for module in env.module_list:
  8. f.write("#define %s\n" % ("MODULE_" + module.upper() + "_ENABLED"))
  9. def generate_modules_tests(target, source, env):
  10. import os
  11. with open(target[0].path, "w") as f:
  12. for header in source:
  13. f.write('#include "%s"\n' % (os.path.normpath(header.path)))
  14. if __name__ == "__main__":
  15. subprocess_main(globals())