@@ -244,12 +244,27 @@ def open_local_config_file(self):
244244 # manually update GUI
245245 self .worker_finished ()
246246
247- def build_fw (self ):
248- self .main_app .wSpn_build .setState (BusyIndicatorState .BUSY )
247+ def do_hot_patches (self ):
248+ # Before logging anything, check that we need to do something
249+ ini_lines = read_platformio_ini_file (self .logic_state )
250+ bad_git_tag_re = re .compile (r'(github\.com.+)@' )
251+ if any (bad_git_tag_re .search (ini_line ) for ini_line in ini_lines ):
252+ log .warning ('Hot patching git tag specifiers!!!' )
253+ def patch_line (in_str : str ) -> str :
254+ if bad_git_tag_re .search (in_str ):
255+ out_str = bad_git_tag_re .sub (r'\1#' , in_str )
256+ log .warning (f'Replacing { in_str } with { out_str } ' )
257+ return out_str
258+ else :
259+ return in_str
260+ ini_lines = [
261+ patch_line (line )
262+ for line in ini_lines
263+ ]
264+ with open (Path (self .logic_state .fw_dir , 'platformio.ini' ).resolve (), 'w' ) as fp :
265+ fp .writelines (ini_lines )
249266
250267 if self .logic_state .env_is_avr_based ():
251- # Before logging anything, check that we need to do something
252- ini_lines = read_platformio_ini_file (self .logic_state )
253268 # hard match the entire line
254269 # readline[s]() will always terminate a line with \n (and not \r\n on windows! :D)
255270 # https://docs.python.org/3.11/tutorial/inputoutput.html#methods-of-file-objects
@@ -265,6 +280,12 @@ def build_fw(self):
265280 with open (Path (self .logic_state .fw_dir , 'platformio.ini' ).resolve (), 'w' ) as fp :
266281 fp .writelines (ini_lines )
267282
283+ def build_fw (self ):
284+ self .main_app .wSpn_build .setState (BusyIndicatorState .BUSY )
285+
286+ # Hot patches, since we can't re-release an old firmware tag
287+ self .do_hot_patches ()
288+
268289 config_dest_path = str (Path (self .logic_state .fw_dir , 'Configuration_local.hpp' ).resolve ())
269290 if Path (config_dest_path ) != Path (self .logic_state .config_file_path ):
270291 if QFile .exists (config_dest_path ):
0 commit comments