From 6b77769dec8c47a7a757b009acb01a364c2bd8d8 Mon Sep 17 00:00:00 2001 From: "Jamie C. Driver" Date: Tue, 8 Oct 2024 15:58:32 +0100 Subject: [PATCH] scripts: fix mkdefaults.py for non-*nix platforms Introduced in 2f38d93887187626518c80d9a77679019606bb3f --- tools/mkdefaults.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tools/mkdefaults.py b/tools/mkdefaults.py index fbf07e25..44c7d5fb 100755 --- a/tools/mkdefaults.py +++ b/tools/mkdefaults.py @@ -58,13 +58,21 @@ if cfg.startswith(CFG_TARGET + '='): target_chip = cfg[len(CFG_TARGET) + 1:] -# Backup existing sdkconfig.default file +# Backup/remove existing sdkconfig files if os.path.isfile('./sdkconfig.defaults'): os.rename('./sdkconfig.defaults', './sdkconfig.defaults.orig') +if os.path.isfile('./sdkconfig'): + os.remove('./sdkconfig') + +subprocess.check_call(f'idf.py set-target {target_chip}', shell=True) + +# Remove recreated sdkconfig files +if os.path.isfile('./sdkconfig.defaults'): + os.remove('./sdkconfig.defaults') +if os.path.isfile('./sdkconfig'): + os.remove('./sdkconfig') # Process tempfile with 'idf.py reconfigure write-defconfig' to create new sdkconfig.defaults -subprocess.check_call(f'idf.py set-target {target_chip} && rm -f sdkconfig sdkconfig.defaults', - shell=True) subprocess.check_call(f'idf.py -D SDKCONFIG_DEFAULTS="{TEMPFILE}" reconfigure save-defconfig', shell=True)