bootstrapper: improve heuristic for --zephyr-base
We're seeing warnings when people have ZEPHYR_BASE set to the "<directory>" they pass to "west init -l <directory>". Avoid them exactly in the situation that <directory> is a zephyr repository by using the manifest directory as ZEPHYR_BASE. For upstream, that is correct anyway. Merge a couple of lines while here as a cosmetic improvement. Fixes: #167 Signed-off-by: Marti Bolivar <marti@foundries.io>
This commit is contained in:
parent
fcfada8b50
commit
a74b9f1dcc
|
@ -224,8 +224,7 @@ to handle any resetting yourself.
|
||||||
|
|
||||||
def initialize_west(args):
|
def initialize_west(args):
|
||||||
'''Initialize a West installation in existing project.'''
|
'''Initialize a West installation in existing project.'''
|
||||||
manifest_dir = args.directory or os.getcwd()
|
manifest_dir = os.path.abspath(args.directory or os.getcwd())
|
||||||
manifest_dir = os.path.abspath(manifest_dir)
|
|
||||||
directory = os.path.dirname(manifest_dir)
|
directory = os.path.dirname(manifest_dir)
|
||||||
|
|
||||||
manifest_file = os.path.join(manifest_dir, 'west.yml')
|
manifest_file = os.path.join(manifest_dir, 'west.yml')
|
||||||
|
@ -240,9 +239,14 @@ def initialize_west(args):
|
||||||
#
|
#
|
||||||
# Note: main west will try to discover zephyr base and fail, as it is
|
# Note: main west will try to discover zephyr base and fail, as it is
|
||||||
# not fully initialized at this time.
|
# not fully initialized at this time.
|
||||||
# Thus a dummy zephyr_base is provided.
|
#
|
||||||
|
# The real fix is to eliminate post-init, merge the two mains, and
|
||||||
|
# have west init be a special case that doesn't set up
|
||||||
|
# ZEPHYR_BASE. For now, we assume the original argument (or cwd)
|
||||||
|
# is a Zephyr repository, since that's how people are using it in
|
||||||
|
# practice.
|
||||||
os.chdir(directory)
|
os.chdir(directory)
|
||||||
cmd = ['--zephyr-base', directory, 'post-init', '--local',
|
cmd = ['--zephyr-base', manifest_dir, 'post-init', '--local',
|
||||||
os.path.abspath(manifest_dir)]
|
os.path.abspath(manifest_dir)]
|
||||||
wrap(cmd)
|
wrap(cmd)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue