Skip to content

Commit 0413ce3

Browse files
authored
[BugFix] Fix function to read all file (#15225)
fix function to read all file
1 parent a60cd0f commit 0413ce3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

apps/microtvm/arduino/template_project/microtvm_api_server.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -586,10 +586,11 @@ def _get_arduino_port(
586586
def _get_board_from_makefile(self, makefile_path: pathlib.Path) -> str:
587587
"""Get Board from generated Makefile."""
588588
with open(makefile_path) as makefile_f:
589-
line = makefile_f.readline()
590-
if "BOARD" in line:
591-
board = re.sub(r"\s", "", line).split(":=")[1]
592-
return board
589+
lines = makefile_f.readlines()
590+
for line in lines:
591+
if "BOARD" in line:
592+
board = re.sub(r"\s", "", line).split(":=")[1]
593+
return board
593594
raise RuntimeError("Board was not found in Makefile: {}".format(makefile_path))
594595

595596
FLASH_TIMEOUT_SEC = 60

0 commit comments

Comments
 (0)