From c42e51d00b6d5f43f4eb2808d592ed8d9f89f70c Mon Sep 17 00:00:00 2001 From: Dhairya Shah Date: Tue, 11 Apr 2023 21:44:41 +0530 Subject: [PATCH] [ESP32] Simplifies SimpleNamespace creation for generating factory partition with and without encryption (#26015) * [tools] Simplifies SimpleNamespace creation and usage for generating nvs binary with and without encryption in 'scripts/tools/generate_esp32_chip_factory_bin.py' Signed-off-by: dhairyashah1 * Restyled by autopep8 --------- Signed-off-by: dhairyashah1 Co-authored-by: Restyled.io --- .../tools/generate_esp32_chip_factory_bin.py | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/scripts/tools/generate_esp32_chip_factory_bin.py b/scripts/tools/generate_esp32_chip_factory_bin.py index b7dd96eb0d2d07..fac1c274e70a67 100755 --- a/scripts/tools/generate_esp32_chip_factory_bin.py +++ b/scripts/tools/generate_esp32_chip_factory_bin.py @@ -400,22 +400,17 @@ def generate_nvs_csv(out_csv_filename): def generate_nvs_bin(encrypt, size, csv_filename, bin_filename): + nvs_args = SimpleNamespace(version=2, + outdir=os.getcwd(), + input=csv_filename, + output=bin_filename, + size=hex(size)) if encrypt: - nvs_args = SimpleNamespace(version=2, - keygen=True, - keyfile=NVS_KEY_PARTITION_BIN, - inputkey=None, - outdir=os.getcwd(), - input=csv_filename, - output=bin_filename, - size=hex(size)) + nvs_args.keygen = True + nvs_args.keyfile = NVS_KEY_PARTITION_BIN + nvs_args.inputkey = None, nvs_partition_gen.encrypt(nvs_args) else: - nvs_args = SimpleNamespace(input=csv_filename, - output=bin_filename, - size=hex(size), - outdir=os.getcwd(), - version=2) nvs_partition_gen.generate(nvs_args)