From 653608e9314ad668f6246d4b9ab7e834b6adb1c7 Mon Sep 17 00:00:00 2001 From: "Alexander D. Kanevskiy" Date: Sat, 27 Feb 2021 02:03:11 +0200 Subject: [PATCH] Fix preflight complex extend handling (#21191) --- .../PlatformIO/scripts/preflight-checks.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/buildroot/share/PlatformIO/scripts/preflight-checks.py b/buildroot/share/PlatformIO/scripts/preflight-checks.py index 14807d954..c20e5cb7a 100644 --- a/buildroot/share/PlatformIO/scripts/preflight-checks.py +++ b/buildroot/share/PlatformIO/scripts/preflight-checks.py @@ -1,6 +1,6 @@ # # preflight-checks.py -# Script to check for common issues prior to compiling +# Check for common issues prior to compiling # import os import re @@ -25,9 +25,12 @@ def check_envs(build_env, base_envs, config): return True ext = config.get(build_env, 'extends', default=None) if ext: - for ext_env in ext: - if check_envs(ext_env, base_envs, config): - return True + if isinstance(ext, str): + return check_envs(ext, base_envs, config) + elif isinstance(ext, list): + for ext_env in ext: + if check_envs(ext_env, base_envs, config): + return True return False # Sanity checks: @@ -56,7 +59,7 @@ if not result: # Check for Config files in two common incorrect places # for p in [ env['PROJECT_DIR'], os.path.join(env['PROJECT_DIR'], "config") ]: - for f in [ "Configuration.h", "Configuration_adv.h" ]: - if os.path.isfile(os.path.join(p, f)): - err = "ERROR: Config files found in directory %s. Please move them into the Marlin subfolder." % p - raise SystemExit(err) + for f in [ "Configuration.h", "Configuration_adv.h" ]: + if os.path.isfile(os.path.join(p, f)): + err = "ERROR: Config files found in directory %s. Please move them into the Marlin subfolder." % p + raise SystemExit(err)