Files
allwpilib/thirdparty/imgui_suite/generate_gl3w.py
Tyler Veness a48f3c35f4 Remove argv usage from Python scripts (#7311)
argparse will automatically read sys.argv, so we don't need to pass it
in manually. Furthermore, none of our scripts customize argv.
2024-11-02 19:09:32 -07:00

31 lines
710 B
Python
Executable File

#!/usr/bin/env python3
import argparse
import os
from pathlib import Path
import sys
def main():
script_path = Path(__file__).resolve()
dirname = script_path.parent
parser = argparse.ArgumentParser()
parser.add_argument(
"--output_directory",
help="Optional. If set, will output the generated files to this directory, otherwise it will use a path relative to the script",
default=dirname / "generated/gl3w",
type=Path,
)
args = parser.parse_args()
sys.path.append(str(dirname / "gl3w"))
args.output_directory.mkdir(parents=True, exist_ok=True)
os.chdir(args.output_directory)
import gl3w_gen
if __name__ == "__main__":
main()