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/11/01 17:18:36 UTC

[GitHub] [tvm] areusch commented on a change in pull request #9309: [microTVM] Add microTVM Template Projects to tlcpack pip Package

areusch commented on a change in pull request #9309:
URL: https://github.com/apache/tvm/pull/9309#discussion_r739419339



##########
File path: cmake/modules/Arduino.cmake
##########
@@ -0,0 +1,78 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more contributor
+# license agreements.  See the NOTICE file distributed with this work for
+# additional information regarding copyright ownership.  The ASF licenses this
+# file to you under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License.  You may obtain a copy of
+# the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+if(USE_MICRO)
+  message(STATUS "Add Arduino for microTVM")
+
+  function(microtvm_add_arduino)
+    list(
+      APPEND
+      ARDUINO_FILE_COPY_JOBS
+      "apps/microtvm/arduino/template_project microtvm_api_server.py -> arduino"

Review comment:
       should we not copy the whole template_project?

##########
File path: apps/microtvm/arduino/template_project/microtvm_api_server.py
##########
@@ -287,11 +288,11 @@ def _find_modified_include_path(self, project_dir, file_path, include_path):
         return include_path
 
     def _get_platform_version(self, arduino_cli_path: str) -> float:
+        # sample output of this command:
+        # 'arduino-cli alpha Version: 0.18.3 Commit: d710b642 Date: 2021-05-14T12:36:58Z\n'
         version_output = subprocess.check_output([arduino_cli_path, "version"], encoding="utf-8")
-        version_output = (
-            version_output.replace("\n", "").replace("\r", "").replace(":", "").lower().split(" ")
-        )
-        full_version = version_output[version_output.index("version") + 1].split(".")
+        full_version = re.findall("version: ([\.0-9]*)", version_output.lower())

Review comment:
       nit: should add `r" string prefix` (see https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals regarding backslashes)




-- 
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