@@ -449,32 +449,44 @@ def find_board():
449
449
try :
450
450
output = subprocess .check_output (
451
451
[arduino_cli , "board" , "listall" , "--format" , "json" ],
452
- stderr = subprocess .DEVNULL ,
452
+ stderr = subprocess .STDOUT ,
453
453
).decode ("utf-8" )
454
+ except subprocess .CalledProcessError as e :
455
+ print ('"' + " " .join (e .cmd ) + '" failed with code: {}!' .format (e .returncode ))
456
+ print (e .stdout )
457
+ quit (e .returncode )
458
+ else :
454
459
boards_list = json .loads (output )
455
460
if boards_list is not None :
456
461
for board in boards_list ["boards" ]:
457
462
if arduino_platform in board ["FQBN" ]:
458
463
fqbn_list_tmp .append (board ["FQBN" ])
459
464
if not len (fqbn_list_tmp ):
460
- raise subprocess .CalledProcessError (2 , "No fqbn" )
465
+ print ("No boards found for " + arduino_platform )
466
+ quit (1 )
461
467
else :
462
- raise subprocess .CalledProcessError (1 , "No fqbn" )
463
- except subprocess .CalledProcessError :
464
- print ("No fqbn found for " + arduino_platform + "!" )
465
- quit (1 )
468
+ print ("No boards found" + arduino_platform )
469
+ quit (1 )
466
470
467
471
# For STM32 core, pnum is requested
468
472
for fqbn in fqbn_list_tmp :
469
473
try :
470
474
output = subprocess .check_output (
471
475
[arduino_cli , "board" , "details" , "--format" , "json" , fqbn ],
472
- stderr = subprocess .DEVNULL ,
476
+ stderr = subprocess .STDOUT ,
473
477
).decode ("utf-8" )
478
+ except subprocess .CalledProcessError as e :
479
+ print (
480
+ '"' + " " .join (e .cmd ) + '" failed with code: {}!' .format (e .returncode )
481
+ )
482
+ print (e .stdout )
483
+ quit (e .returncode )
484
+ else :
474
485
board_detail = json .loads (output )
475
486
if board_detail is not None :
476
487
if "config_options" not in board_detail :
477
- raise subprocess .CalledProcessError (3 , "No config_options" )
488
+ print ("No config_options found for " + fqbn )
489
+ quit (1 )
478
490
for option in board_detail ["config_options" ]:
479
491
if option ["option" ] == "pnum" :
480
492
for value in option ["values" ]:
@@ -486,9 +498,7 @@ def find_board():
486
498
)
487
499
break
488
500
else :
489
- raise subprocess .CalledProcessError (1 , "No fqbn" )
490
- except subprocess .CalledProcessError as e :
491
- print ('No fqbn detail found for:"' + " " .join (e .cmd ) + '"!' )
501
+ print ('No detail found for:"' + fqbn + '"!' )
492
502
if board_found :
493
503
board_fqbn = collections .OrderedDict (sorted (board_found .items ()))
494
504
else :
0 commit comments