Fix preflight complex extend handling (#21191)

This commit is contained in:
Alexander D. Kanevskiy 2021-02-27 02:03:11 +02:00 committed by Scott Lahteine
parent 80aac1b711
commit 653608e931

View File

@ -1,6 +1,6 @@
# #
# preflight-checks.py # preflight-checks.py
# Script to check for common issues prior to compiling # Check for common issues prior to compiling
# #
import os import os
import re import re
@ -25,9 +25,12 @@ def check_envs(build_env, base_envs, config):
return True return True
ext = config.get(build_env, 'extends', default=None) ext = config.get(build_env, 'extends', default=None)
if ext: if ext:
for ext_env in ext: if isinstance(ext, str):
if check_envs(ext_env, base_envs, config): return check_envs(ext, base_envs, config)
return True elif isinstance(ext, list):
for ext_env in ext:
if check_envs(ext_env, base_envs, config):
return True
return False return False
# Sanity checks: # Sanity checks:
@ -56,7 +59,7 @@ if not result:
# Check for Config files in two common incorrect places # Check for Config files in two common incorrect places
# #
for p in [ env['PROJECT_DIR'], os.path.join(env['PROJECT_DIR'], "config") ]: for p in [ env['PROJECT_DIR'], os.path.join(env['PROJECT_DIR'], "config") ]:
for f in [ "Configuration.h", "Configuration_adv.h" ]: for f in [ "Configuration.h", "Configuration_adv.h" ]:
if os.path.isfile(os.path.join(p, f)): 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 err = "ERROR: Config files found in directory %s. Please move them into the Marlin subfolder." % p
raise SystemExit(err) raise SystemExit(err)