From 40af620748af87408808a28bc830f4c884f9f0a0 Mon Sep 17 00:00:00 2001 From: Anthony Shoumikhin Date: Mon, 2 Oct 2023 17:53:00 -0700 Subject: [PATCH] Pass flatc executable path via env var for exir serializer. (#568) Summary: Pull Request resolved: https://github.com/pytorch/executorch/pull/568 Reviewed By: dbort Differential Revision: D49843232 --- exir/_serialize/_flatbuffer.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/exir/_serialize/_flatbuffer.py b/exir/_serialize/_flatbuffer.py index acb22311b85..5e6d579b02e 100644 --- a/exir/_serialize/_flatbuffer.py +++ b/exir/_serialize/_flatbuffer.py @@ -186,8 +186,9 @@ def _run_flatc(args: Sequence[str]) -> None: with importlib.resources.path(__package__, _FLATC_RESOURCE_NAME) as flatc_path: subprocess.run([flatc_path] + list(args), check=True) else: - # Expect the `flatc` tool to be on the system path. - subprocess.run(["flatc"] + list(args), check=True) + # Expect the `flatc` tool to be on the system path or set as an env var. + flatc_path = os.getenv("FLATC_EXECUTABLE", "flatc") + subprocess.run([flatc_path] + list(args), check=True) def _flatc_compile(output_dir: str, schema_path: str, json_path: str) -> None: