You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/10/22 21:16:32 UTC

[GitHub] [tvm] guberti commented on a change in pull request #9274: [microTVM] Add platform version check to template project

guberti commented on a change in pull request #9274:
URL: https://github.com/apache/tvm/pull/9274#discussion_r734846374



##########
File path: apps/microtvm/arduino/template_project/microtvm_api_server.py
##########
@@ -335,7 +337,23 @@ def _find_modified_include_path(self, project_dir, file_path, include_path):
         # It's probably a standard C/C++ header
         return include_path
 
+    def _get_platform_version(self, arduino_cli_path: str) -> str:
+        version_output = subprocess.check_output([arduino_cli_path, "version"], encoding="utf-8")
+        version_output = (
+            version_output.replace("\n", "").replace("\r", "").replace(":", "").lower().split(" ")
+        )
+        version_index = version_output.index("version") + 1
+
+        return version_output[version_index]
+
     def generate_project(self, model_library_format_path, standalone_crt_dir, project_dir, options):
+        # Check Arduino version
+        version = self._get_platform_version(options["arduino_cli_cmd"])
+        if version != ARDUINO_CLI_VERSION:

Review comment:
       Yea the Arduino CLI seems to be relatively stable - this looks fine to me.

##########
File path: apps/microtvm/arduino/template_project/microtvm_api_server.py
##########
@@ -275,7 +286,25 @@ def _find_modified_include_path(self, project_dir, file_path, include_path):
         # It's probably a standard C/C++ header
         return include_path
 
+    def _get_platform_version(self, arduino_cli_path: str) -> float:
+        version_output = subprocess.check_output([arduino_cli_path, "version"], encoding="utf-8")
+        version_output = (
+            version_output.replace("\n", "").replace("\r", "").replace(":", "").lower().split(" ")

Review comment:
       What exactly is this line stripping out? Can we use a regex or `.strip()`? I'd love to see a comment here with the standard output of `arduino-cli version` so I can better understand what's happening here.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org