Skip to content

Commit

Permalink
xtensa-build-zephyr.py: de-duplicate common code
Browse files Browse the repository at this point in the history
De-duplicate this code:

	if args.platforms:
		build_platforms()
		show_installed_files()

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
  • Loading branch information
marc-hb authored and lgirdwood committed Mar 10, 2022
1 parent fc3bc3c commit 7a847a5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions scripts/xtensa-build-zephyr.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def parse_args():
if args.clone_mode and not args.z:
args.z = "main" # set default name for -z if -c specified

if args.west_path: # allow user override path to zephyr project
if args.west_path: # let the user provide an already existing zephyrproject/ anywhere
west_top = pathlib.Path(args.west_path)
elif not args.clone_mode: # if neather -p nor -c provided, use -p
args.west_path = west_top
Expand Down Expand Up @@ -422,9 +422,6 @@ def run_clone_mode():
create_zephyr_directory()
west_init_update()
git_submodules_update()
if args.platforms:
build_platforms()
show_installed_files()

def run_point_mode():
global west_top, SOF_TOP
Expand All @@ -436,9 +433,6 @@ def run_point_mode():
raise FileNotFoundError("West topdir returned {} as workspace but it"
" does not exist".format(west_workspace_path))
create_zephyr_sof_symlink()
if args.platforms:
build_platforms()
show_installed_files()

def main():
parse_args()
Expand All @@ -448,11 +442,17 @@ def main():
else:
print("Building platforms: {}".format(" ".join(args.platforms)))

# Two mutually exclusive working modes are supported
# we made two modes mutually exclusive with argparse
if args.west_path:
# check west_path input + create symlink if needed
run_point_mode()
if args.clone_mode:
# Initialize zephyr project with west
run_clone_mode()

if args.platforms:
build_platforms()
show_installed_files()

if __name__ == "__main__":
main()

0 comments on commit 7a847a5

Please sign in to comment.