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 <marti.bolivar@nordicsemi.no>
This commit is contained in:
Marti 2019-04-09 13:16:01 -06:00 committed by Carles Cufí
parent bb718c5a78
commit fd53d839e9
1 changed files with 4 additions and 1 deletions

View File

@ -478,7 +478,10 @@ def wrap(argv):
# Put this at position 1 to make sure it comes before random stuff # 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. # that might be on a developer's PYTHONPATH in the import order.
sys.path.insert(1, os.path.join(west_git_repo, 'src')) 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) west.main.main(argv)