From c4a4529465356e3b783a52fb1bb1c2536e6c2a41 Mon Sep 17 00:00:00 2001 From: dhairyashah1 Date: Fri, 7 Apr 2023 16:21:05 +0530 Subject: [PATCH 1/2] [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 --- .../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..6b5650e2baa441 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) From 36d0ea4369dcaab566fcc2a7c9c3c580be478b8f Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Fri, 7 Apr 2023 11:08:02 +0000 Subject: [PATCH 2/2] Restyled by autopep8 --- scripts/tools/generate_esp32_chip_factory_bin.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/tools/generate_esp32_chip_factory_bin.py b/scripts/tools/generate_esp32_chip_factory_bin.py index 6b5650e2baa441..fac1c274e70a67 100755 --- a/scripts/tools/generate_esp32_chip_factory_bin.py +++ b/scripts/tools/generate_esp32_chip_factory_bin.py @@ -400,11 +400,11 @@ 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)) + nvs_args = SimpleNamespace(version=2, + outdir=os.getcwd(), + input=csv_filename, + output=bin_filename, + size=hex(size)) if encrypt: nvs_args.keygen = True nvs_args.keyfile = NVS_KEY_PARTITION_BIN