Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions exir/_serialize/_flatbuffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import os
import re
import shutil
import stat
import subprocess

import tempfile
Expand Down Expand Up @@ -252,6 +253,15 @@ def _run_flatc(args: Sequence[str]) -> None:
if flatc_resource.is_file():
# Use the provided flatc binary.
with importlib.resources.as_file(flatc_resource) as flatc_path:
# Ensure the binary has execute permissions (needed for PAR files)
try:
current_mode = flatc_path.stat().st_mode
if not (current_mode & stat.S_IXUSR):
flatc_path.chmod(
current_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH
)
except OSError:
pass
subprocess.run([flatc_path] + list(args), check=True)
else:
# Expect the `flatc` tool to be on the system path or set as an env var.
Expand Down
Loading