2026-03-06 02:18:37 -05:00
|
|
|
|
|
|
|
|
import sys
|
|
|
|
|
import tomli
|
|
|
|
|
|
2026-06-03 22:43:16 -04:00
|
|
|
def load_project_names(toml_filename, project_type):
|
2026-03-06 02:18:37 -05:00
|
|
|
|
|
|
|
|
with open(toml_filename, "rb") as f:
|
|
|
|
|
data = tomli.load(f)
|
|
|
|
|
|
2026-06-03 22:43:16 -04:00
|
|
|
contents = f"{project_type.upper()}_PROJECTS = [\n"
|
2026-03-06 02:18:37 -05:00
|
|
|
for test_folder in data["tests"]["base"]:
|
2026-06-03 22:43:16 -04:00
|
|
|
contents += f' "{project_type}s/{test_folder}",\n'
|
2026-03-06 02:18:37 -05:00
|
|
|
contents += "]\n"
|
|
|
|
|
|
2026-06-03 22:43:16 -04:00
|
|
|
return contents
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
|
output_file = "robotpyExamples/example_projects.bzl"
|
|
|
|
|
|
|
|
|
|
contents = load_project_names("robotpyExamples/examples/examples.toml", "example")
|
|
|
|
|
contents += load_project_names("robotpyExamples/snippets/snippets.toml", "snippet")
|
|
|
|
|
|
2026-03-06 02:18:37 -05:00
|
|
|
if len(sys.argv) == 2:
|
|
|
|
|
output_file = sys.argv[1]
|
|
|
|
|
|
|
|
|
|
with open(output_file, "w") as f:
|
|
|
|
|
f.write(contents)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
main()
|