waf: Detect board class by inheritance instead of naming

This commit is contained in:
Oleksiy Protas 2023-12-09 17:14:01 +02:00 committed by Andrew Tridgell
parent 364e6f06f3
commit 4e21dbcc0b
2 changed files with 5 additions and 2 deletions

View File

@ -578,6 +578,9 @@ def get_boards_names():
return sorted(list(_board_classes.keys()), key=str.lower) return sorted(list(_board_classes.keys()), key=str.lower)
def is_board_based(board, cls):
return issubclass(_board_classes[board], cls)
def get_ap_periph_boards(): def get_ap_periph_boards():
'''Add AP_Periph boards based on existance of periph keywork in hwdef.dat or board name''' '''Add AP_Periph boards based on existance of periph keywork in hwdef.dat or board name'''
list_ap = [s for s in list(_board_classes.keys()) if "periph" in s] list_ap = [s for s in list(_board_classes.keys()) if "periph" in s]

View File

@ -674,9 +674,9 @@ def generate_tasklist(ctx, do_print=True):
elif 'iofirmware' in board: elif 'iofirmware' in board:
task['targets'] = ['iofirmware', 'bootloader'] task['targets'] = ['iofirmware', 'bootloader']
else: else:
if 'sitl' in board or 'SITL' in board: if boards.is_board_based(board, boards.sitl):
task['targets'] = ['antennatracker', 'copter', 'heli', 'plane', 'rover', 'sub', 'replay'] task['targets'] = ['antennatracker', 'copter', 'heli', 'plane', 'rover', 'sub', 'replay']
elif 'linux' in board: elif boards.is_board_based(board, boards.linux):
task['targets'] = ['antennatracker', 'copter', 'heli', 'plane', 'rover', 'sub'] task['targets'] = ['antennatracker', 'copter', 'heli', 'plane', 'rover', 'sub']
else: else:
task['targets'] = ['antennatracker', 'copter', 'heli', 'plane', 'rover', 'sub', 'bootloader'] task['targets'] = ['antennatracker', 'copter', 'heli', 'plane', 'rover', 'sub', 'bootloader']