From 7c9866db08e5f5c1ef26a2c10f73a6b04a97c4ac Mon Sep 17 00:00:00 2001 From: Austin Bozowski Date: Tue, 24 May 2022 20:23:53 +0000 Subject: [PATCH] Move non re-used logic to chef, simplify --- examples/chef/chef.py | 10 +++++++++- examples/chef/chef_util.py | 15 --------------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/examples/chef/chef.py b/examples/chef/chef.py index a0e06f6e08a4ef..f44e23d5bb8df9 100755 --- a/examples/chef/chef.py +++ b/examples/chef/chef.py @@ -259,7 +259,15 @@ def main(argv: Sequence[str]) -> None: # if options.build_all: - chef_util.build_all(chef_devices_dir, _CHEF_SCRIPT_PATH) + platforms_and_outputs = chef_util.cd_platforms_and_outputs + for device in os.listdir(chef_devices_dir): + target_file_ext = ".zap" + if device.endswith(target_file_ext): + device_name = device[:-len(target_file_ext)] + for platform, directory in platforms_and_outputs.items(): + platforms_and_outputs[platform] = os.path.join(_CHEF_SCRIPT_PATH, directory) + command = './chef.py -czbr -d {} -t {}'.format(device_name, platform) + subprocess.check_call(command, cwd=_CHEF_SCRIPT_PATH, shell=True) exit(0) # diff --git a/examples/chef/chef_util.py b/examples/chef/chef_util.py index 348e841f0b6ea7..592eea79d230e4 100644 --- a/examples/chef/chef_util.py +++ b/examples/chef/chef_util.py @@ -38,18 +38,3 @@ def generate_device_manifest(chef_devices_dir: str, include_zap_submod: bool = F with open(ci_manifest_file_name, "w+", encoding="utf-8") as ci_manifest_file: ci_manifest_file.write(json.dumps(ci_manifest, indent=4)) return ci_manifest - -def create_build_command(zap: str, platform: str) -> str: - return './chef.py -czbr -d {} -t {}'.format(zap, platform) - -def build_all(device_dir: str, chef_script_path: str) -> None: - devices = [] - for device in os.listdir(device_dir): - target_file_ext = ".zap" - if device.endswith(target_file_ext): - devices.append(device[:-len(target_file_ext)]) - for platform, directory in cd_platforms_and_outputs.items(): - cd_platforms_and_outputs[platform] = os.path.join(chef_script_path, directory) - for device in devices: - command = create_build_command(device, platform) - subprocess.check_call(command, cwd=chef_script_path, shell=True)