1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-26 13:25:54 +00:00

🔨 Fix preflight checks order (#27285)

Followup to #27249
This commit is contained in:
ellensp 2024-07-18 11:01:10 +12:00 committed by GitHub
parent 2b8db0c2e2
commit c852e9c6a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -62,6 +62,28 @@ if pioutil.is_pio_build():
if 'MARLIN_FEATURES' not in env:
raise SystemExit("Error: this script should be used after common Marlin scripts.")
# Useful values
project_dir = Path(env['PROJECT_DIR'])
config_files = ("Configuration.h", "Configuration_adv.h")
#
# Update old macros BOTH and EITHER in configuration files
#
conf_modified = False
for f in config_files:
conf_path = project_dir / "Marlin" / f
if conf_path.is_file():
with open(conf_path, 'r', encoding="utf8") as file:
text = file.read()
modified_text = text.replace("BOTH(", "ALL(").replace("EITHER(", "ANY(")
if text != modified_text:
conf_modified = True
with open(conf_path, 'w') as file:
file.write(modified_text)
if conf_modified:
raise SystemExit('WARNING: Configuration files needed an update to remove incompatible items. Try the build again to use the updated files.')
if len(env['MARLIN_FEATURES']) == 0:
raise SystemExit("Error: Failed to parse Marlin features. See previous error messages.")
@ -78,10 +100,6 @@ if pioutil.is_pio_build():
( build_env, motherboard, ", ".join([ e[4:] for e in board_envs if e.startswith("env:") ]) )
raise SystemExit(err)
# Useful values
project_dir = Path(env['PROJECT_DIR'])
config_files = ("Configuration.h", "Configuration_adv.h")
#
# Check for Config files in two common incorrect places
#
@ -140,22 +158,5 @@ if pioutil.is_pio_build():
err = "ERROR: FILAMENT_RUNOUT_SCRIPT needs a %c parameter (e.g., \"M600 T%c\") when NUM_RUNOUT_SENSORS is > 1"
raise SystemExit(err)
#
# Update old macros BOTH and EITHER in configuration files
#
conf_modified = False
for f in config_files:
conf_path = project_dir / "Marlin" / f
if conf_path.is_file():
with open(conf_path, 'r', encoding="utf8") as file:
text = file.read()
modified_text = text.replace("BOTH(", "ALL(").replace("EITHER(", "ANY(")
if text != modified_text:
conf_modified = True
with open(conf_path, 'w') as file:
file.write(modified_text)
if conf_modified:
raise SystemExit('WARNING: Configuration files needed an update to remove incompatible items. Try the build again to use the updated files.')
sanity_check_target()