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

tqchen 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 8b44741  [µTVM] Raise a better error when project_dir does not exist 
(#7165)
8b44741 is described below

commit 8b447411b1948bea3785059ffae4daa890b5a971
Author: Andrew Reusch <[email protected]>
AuthorDate: Tue Jan 5 13:16:31 2021 -0800

    [µTVM] Raise a better error when project_dir does not exist (#7165)
---
 python/tvm/micro/contrib/zephyr.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/python/tvm/micro/contrib/zephyr.py 
b/python/tvm/micro/contrib/zephyr.py
index 6625498..61aec2b 100644
--- a/python/tvm/micro/contrib/zephyr.py
+++ b/python/tvm/micro/contrib/zephyr.py
@@ -58,6 +58,10 @@ class SubprocessEnv(object):
         return subprocess.check_output(cmd, env=env, **kw)
 
 
+class ProjectNotFoundError(Exception):
+    """Raised when the project_dir supplied to ZephyrCompiler does not 
exist."""
+
+
 class FlashRunnerNotSupported(Exception):
     """Raised when the FLASH_RUNNER for a project isn't supported by this 
Zephyr adapter."""
 
@@ -95,6 +99,13 @@ class ZephyrCompiler(tvm.micro.Compiler):
             If given, additional environment variables present when invoking 
west, cmake, or make.
         """
         self._project_dir = project_dir
+        if not os.path.exists(project_dir):
+            # Raise this error instead of a potentially-more-cryptic compiler 
error due to a missing
+            # prj.conf.
+            raise ProjectNotFoundError(
+                f"project_dir supplied to ZephyrCompiler does not exist: 
{project_dir}"
+            )
+
         self._board = board
         if west_cmd is None:
             self._west_cmd = [sys.executable, "-mwest.app.main"]

Reply via email to