@@ -62,6 +62,28 @@ def sanity_check_target():
62
62
if 'MARLIN_FEATURES' not in env :
63
63
raise SystemExit ("Error: this script should be used after common Marlin scripts." )
64
64
65
+ # Useful values
66
+ project_dir = Path (env ['PROJECT_DIR' ])
67
+ config_files = ("Configuration.h" , "Configuration_adv.h" )
68
+
69
+ #
70
+ # Update old macros BOTH and EITHER in configuration files
71
+ #
72
+ conf_modified = False
73
+ for f in config_files :
74
+ conf_path = project_dir / "Marlin" / f
75
+ if conf_path .is_file ():
76
+ with open (conf_path , 'r' , encoding = "utf8" ) as file :
77
+ text = file .read ()
78
+ modified_text = text .replace ("BOTH(" , "ALL(" ).replace ("EITHER(" , "ANY(" )
79
+ if text != modified_text :
80
+ conf_modified = True
81
+ with open (conf_path , 'w' ) as file :
82
+ file .write (modified_text )
83
+
84
+ if conf_modified :
85
+ raise SystemExit ('WARNING: Configuration files needed an update to remove incompatible items. Try the build again to use the updated files.' )
86
+
65
87
if len (env ['MARLIN_FEATURES' ]) == 0 :
66
88
raise SystemExit ("Error: Failed to parse Marlin features. See previous error messages." )
67
89
@@ -78,10 +100,6 @@ def sanity_check_target():
78
100
( build_env , motherboard , ", " .join ([ e [4 :] for e in board_envs if e .startswith ("env:" ) ]) )
79
101
raise SystemExit (err )
80
102
81
- # Useful values
82
- project_dir = Path (env ['PROJECT_DIR' ])
83
- config_files = ("Configuration.h" , "Configuration_adv.h" )
84
-
85
103
#
86
104
# Check for Config files in two common incorrect places
87
105
#
@@ -140,22 +158,5 @@ def rm_ofile(subdir, name):
140
158
err = "ERROR: FILAMENT_RUNOUT_SCRIPT needs a %c parameter (e.g., \" M600 T%c\" ) when NUM_RUNOUT_SENSORS is > 1"
141
159
raise SystemExit (err )
142
160
143
- #
144
- # Update old macros BOTH and EITHER in configuration files
145
- #
146
- conf_modified = False
147
- for f in config_files :
148
- conf_path = project_dir / "Marlin" / f
149
- if conf_path .is_file ():
150
- with open (conf_path , 'r' , encoding = "utf8" ) as file :
151
- text = file .read ()
152
- modified_text = text .replace ("BOTH(" , "ALL(" ).replace ("EITHER(" , "ANY(" )
153
- if text != modified_text :
154
- conf_modified = True
155
- with open (conf_path , 'w' ) as file :
156
- file .write (modified_text )
157
-
158
- if conf_modified :
159
- raise SystemExit ('WARNING: Configuration files needed an update to remove incompatible items. Try the build again to use the updated files.' )
160
161
161
162
sanity_check_target ()
0 commit comments