@@ -409,17 +409,23 @@ def test_examples_in_folder(platform, folderpath):
409
409
if os .path .exists (gen_file_name ):
410
410
ColorPrint .print_info ("generating" )
411
411
412
- # check if boards.local.txt should be copied
412
+
413
+ # check if root or example-specific boards.local.txt should be copied
413
414
if COPY_BOARDS_LOCAL_TXT :
414
- boards_local_txt = folderpath + "/." + platform + ".boards.local.txt"
415
- if os .path .exists (boards_local_txt ):
416
- ColorPrint .print_info ("Copying boards.local.txt from " + boards_local_txt )
417
- install_boards_local_txt (":" .join (fqbn .split (':' )[0 :2 ]), boards_local_txt )
418
- elif os .path .exists (folderpath + "/boards.local.txt" ):
419
- ColorPrint .print_info ("Copying boards.local.txt from " + folderpath + "/boards.local.txt" )
420
- install_boards_local_txt (":" .join (fqbn .split (':' )[0 :2 ]), folderpath + "/boards.local.txt" )
421
- else :
415
+ root_boards_local_txt = boards_local_txt
416
+ example_boards_local_txt = folderpath + "/boards.local.txt"
417
+ board_specific_example_boards_local_txt = folderpath + "/." + platform + ".boards.local.txt"
418
+
419
+ if os .path .exists (board_specific_example_boards_local_txt ):
420
+ ColorPrint .print_info ("Copying boards.local.txt from " + board_specific_example_boards_local_txt )
421
+ install_boards_local_txt (":" .join (fqbn .split (':' )[0 :2 ]), board_specific_example_boards_local_txt )
422
+ elif os .path .exists (example_boards_local_txt ):
423
+ ColorPrint .print_info ("Copying boards.local.txt from " + example_boards_local_txt )
424
+ install_boards_local_txt (":" .join (fqbn .split (':' )[0 :2 ]), example_boards_local_txt )
425
+ else : # effectively does the revert if subsequent example doesn't have a specific boards.local.txt
422
426
ColorPrint .print_info ("No example-specific boards.local.txt found to copy, using root version" )
427
+ install_boards_local_txt (":" .join (fqbn .split (':' )[0 :2 ]), root_boards_local_txt )
428
+
423
429
424
430
if BUILD_WARN :
425
431
if os .path .exists (gen_file_name ):
@@ -475,9 +481,9 @@ def install_boards_local_txt(core_fqbn, boards_local_txt):
475
481
name, vendor:architecture (e.g., "adafruit:samd").
476
482
:param str boards_local_txt: The path to the boards.local.txt file.
477
483
"""
484
+ local_app_data_dir = os .environ .get ('HOME' , '' )
485
+ data_dir = None
478
486
try :
479
- local_app_data_dir = os .environ .get ('HOME' , '' )
480
- data_dir = None
481
487
if os .path .exists (os .path .join (local_app_data_dir , '.arduino15' )):
482
488
data_dir = os .path .join (local_app_data_dir , '.arduino15' )
483
489
elif os .path .exists (os .path .join (local_app_data_dir , '.arduino' )):
0 commit comments