Skip to content

Commit

Permalink
[BugFix] Fix function to read all file (apache#15225)
Browse files Browse the repository at this point in the history
fix function to read all file
  • Loading branch information
Red-Caesar authored and junrushao committed Jul 24, 2023
1 parent 959b7e5 commit 857435f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions apps/microtvm/arduino/template_project/microtvm_api_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,10 +586,11 @@ def _get_arduino_port(
def _get_board_from_makefile(self, makefile_path: pathlib.Path) -> str:
"""Get Board from generated Makefile."""
with open(makefile_path) as makefile_f:
line = makefile_f.readline()
if "BOARD" in line:
board = re.sub(r"\s", "", line).split(":=")[1]
return board
lines = makefile_f.readlines()
for line in lines:
if "BOARD" in line:
board = re.sub(r"\s", "", line).split(":=")[1]
return board
raise RuntimeError("Board was not found in Makefile: {}".format(makefile_path))

FLASH_TIMEOUT_SEC = 60
Expand Down

0 comments on commit 857435f

Please sign in to comment.