From fd53d839e9af989d96495a2e90e8bd7d78de0231 Mon Sep 17 00:00:00 2001 From: Marti Date: Tue, 9 Apr 2019 13:16:01 -0600 Subject: [PATCH] bootstrap: check for a missing west.main Print a more helpful message in case .west/west/src doesn't contain an importable west.main module. (A trash .west can remain if 'west init' fails.) Signed-off-by: Marti Bolivar --- src/west/_bootstrap/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/west/_bootstrap/main.py b/src/west/_bootstrap/main.py index d5fb085..88b5ab3 100644 --- a/src/west/_bootstrap/main.py +++ b/src/west/_bootstrap/main.py @@ -478,7 +478,10 @@ def wrap(argv): # Put this at position 1 to make sure it comes before random stuff # that might be on a developer's PYTHONPATH in the import order. sys.path.insert(1, os.path.join(west_git_repo, 'src')) - import west.main + try: + import west.main + except ImportError: + sys.exit('Error: no west.main in ' + west_git_repo) west.main.main(argv)