This is an automated email from the ASF dual-hosted git repository.

syfeng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new 0413ce3138 [BugFix] Fix function to read all file (#15225)
0413ce3138 is described below

commit 0413ce3138da86e12ba10f2c0d62a1252d88bdae
Author: Red-Caesar <[email protected]>
AuthorDate: Mon Jul 10 14:27:21 2023 +0300

    [BugFix] Fix function to read all file (#15225)
    
    fix function to read all file
---
 apps/microtvm/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 f121238a67..735aca120c 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 @@ class Handler(server.ProjectAPIHandler):
     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

Reply via email to