waf: fixed case insensitive board name

This commit is contained in:
Andrew Tridgell 2019-03-07 07:58:56 +11:00
parent b1bbe09602
commit 9e50c1b64e
2 changed files with 7 additions and 6 deletions

View File

@ -295,12 +295,6 @@ Please use a replacement build as follows:
''' % ctx.env.BOARD)
boards = _board_classes.keys()
if not ctx.env.BOARD in boards:
# try case-insensitive match
for b in boards:
if b.upper() == ctx.env.BOARD.upper():
ctx.env.BOARD = b
break
if not ctx.env.BOARD in boards:
ctx.fatal("Invalid board '%s': choices are %s" % (ctx.env.BOARD, ', '.join(boards)))
_board = _board_classes[ctx.env.BOARD]()

View File

@ -325,6 +325,13 @@ def configure(cfg):
if cfg.options.board is None:
cfg.options.board = 'sitl'
boards_names = boards.get_boards_names()
if not cfg.options.board in boards_names:
for b in boards_names:
if b.upper() == cfg.options.board.upper():
cfg.options.board = b
break
cfg.env.BOARD = cfg.options.board
cfg.env.DEBUG = cfg.options.debug
cfg.env.AUTOCONFIG = cfg.options.autoconfig