scripts: print notice that west's copy is a copy

One of the most common issues I've had to deal with as people are
starting to try west is that bash has cached the 'west' binary to the
version in zephyr/scripts/west after they ran zephyr-env.sh on Unix
operating systems.

This makes people (correctly) think they are running an older version
when they get output about missing clone commands, etc., but doesn't
give them any hints about why that happened, because most people don't
know that west is already in widespread use for flashing and
debugging.

To make fielding support for these users easier while we're
transitioning, print a notice at the end of the copy informing users
what just happened. We can make it more forceful as time goes on.

Signed-off-by: Marti Bolivar <marti@foundries.io>
This commit is contained in:
Marti Bolivar 2018-11-16 08:49:43 -07:00 committed by Anas Nashif
commit 18e6c10339

View file

@ -16,6 +16,8 @@ import os
import subprocess
import sys
import colorama
if sys.version_info < (3,):
sys.exit('fatal error: you are running Python 2')
@ -95,10 +97,16 @@ def main():
except WestNotFound:
topdir = None
if topdir is not None:
wrap(topdir, sys.argv[1:])
else:
run_scripts_meta_west()
try:
if topdir is not None:
wrap(topdir, sys.argv[1:])
else:
run_scripts_meta_west()
finally:
print(colorama.Fore.LIGHTRED_EX, end='')
print('NOTE: you just ran a copy of west from zephyr/scripts; this',
'will be removed in the future.')
print(colorama.Style.RESET_ALL, end='', flush=True)
if __name__ == '__main__':