From f77db19000e33390526748ae40382f6fa60ed32b Mon Sep 17 00:00:00 2001 From: Red-Caesar Date: Tue, 4 Jul 2023 14:43:11 +0300 Subject: [PATCH] fix function to read all file --- .../arduino/template_project/microtvm_api_server.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/microtvm/arduino/template_project/microtvm_api_server.py b/apps/microtvm/arduino/template_project/microtvm_api_server.py index f121238a678d..735aca120c59 100644 --- a/apps/microtvm/arduino/template_project/microtvm_api_server.py +++ b/apps/microtvm/arduino/template_project/microtvm_api_server.py @@ -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