Skip to content

Commit 90e5e09

Browse files
authored
Improve error handling for Ninja build file and Python path find
1 parent 2b3b2ca commit 90e5e09

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

builder/frameworks/espidf.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -849,9 +849,12 @@ def _normalize_fragment_path(base_dir, fragment_path):
849849

850850
return fragment_path
851851

852-
assert os.path.isfile(
853-
ninja_buildfile
854-
), "Cannot extract linker fragments! Ninja build file is missing!"
852+
if not os.path.isfile(ninja_buildfile):
853+
sys.stderr.write(
854+
"Error: Missing Ninja build file '%s' for linker fragment extraction\n"
855+
% ninja_buildfile
856+
)
857+
env.Exit(1)
855858

856859
result = []
857860
with open(ninja_buildfile, encoding="utf8") as fp:
@@ -1651,8 +1654,7 @@ def _create_venv(venv_dir):
16511654

16521655

16531656
def get_python_exe():
1654-
python_exe_path = str(Path(get_idf_venv_dir()) / ("Scripts" if IS_WINDOWS else "bin") / ("python" + (".exe" if IS_WINDOWS else "")))
1655-
1657+
python_exe_path = get_executable_path(get_idf_venv_dir(), "python")
16561658
if not os.path.isfile(python_exe_path):
16571659
sys.stderr.write("Error: Missing Python executable file `%s`\n" % python_exe_path)
16581660
env.Exit(1)

0 commit comments

Comments
 (0)