diff --git a/betterproto/plugin.bat b/betterproto/plugin.bat new file mode 100644 index 000000000..9b837d7dc --- /dev/null +++ b/betterproto/plugin.bat @@ -0,0 +1,2 @@ +@SET plugin_dir=%~dp0 +@python %plugin_dir%/plugin.py %* \ No newline at end of file diff --git a/betterproto/tests/generate.py b/betterproto/tests/generate.py index 987f2d9b3..e0fe631e6 100644 --- a/betterproto/tests/generate.py +++ b/betterproto/tests/generate.py @@ -48,13 +48,19 @@ def ensure_ext(filename: str, ext: str) -> str: proto_files = get_files(".proto") json_files = get_files(".json") + if os.name == 'nt': + plugin_path = os.path.join('..', 'plugin.bat') + else: + plugin_path = os.path.join('..', 'plugin.py') + + for filename in proto_files: print(f"Generating code for {os.path.basename(filename)}") subprocess.run( f"protoc --python_out=. {os.path.basename(filename)}", shell=True ) subprocess.run( - f"protoc --plugin=protoc-gen-custom=../plugin.py --custom_out=. {os.path.basename(filename)}", + f"protoc --plugin=protoc-gen-custom={plugin_path} --custom_out=. {os.path.basename(filename)}", shell=True, )