Skip to content

Commit

Permalink
build_all.py: Notify users of known arch, chip and board options (#108)
Browse files Browse the repository at this point in the history
Instead of just exiting on unknown arch, chip or board options,
build_all will now let the user know which choices are available
  • Loading branch information
olofk committed Feb 14, 2021
1 parent 32df5f2 commit 6934ddd
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions build_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ def validate_args(args):
gp['archdir'] = os.path.join(gp['configdir'], args.arch)
gp['bd_archdir'] = os.path.join(gp['bd_configdir'], args.arch)
if not os.path.isdir(gp['archdir']):
log.error('ERROR: Architecture "{arch}" not found: exiting'.format(arch=args.arch))
choices = sorted(os.listdir(gp['configdir']))
_s = 'ERROR: Architecture "{arch}" not found. Valid choices are "{choices}": exiting'
log.error(_s.format(arch=args.arch, choices='", "'.join(choices)))
sys.exit(1)
if not os.access(gp['archdir'], os.R_OK):
log.error('ERROR: Unable to read achitecture "{arch}": exiting'.format(arch=args.arch))
Expand All @@ -155,9 +157,11 @@ def validate_args(args):
gp['chipdir'] = os.path.join(gp['archdir'], 'chips', args.chip)
gp['bd_chipdir'] = os.path.join(gp['bd_archdir'], 'chips', args.chip)
if not os.path.isdir(gp['chipdir']):
log.error(
'ERROR: Chip "{chip}" not found for architecture "{arch}": exiting'.format(chip=args.chip, arch=args.arch)
)
choices = sorted(os.listdir(os.path.join(gp['archdir'], 'chips')))
_s = 'ERROR: Chip "{chip}" not found for architecture "{arch}". Valid choices are "{choices}": exiting'
log.error(_s.format(chip = args.chip,
arch = args.arch,
choices = '", "'.join(choices)))
sys.exit(1)
if not os.access(gp['chipdir'], os.R_OK):
log.error(
Expand All @@ -172,9 +176,11 @@ def validate_args(args):
gp['boarddir'] = os.path.join(gp['archdir'], 'boards', args.board)
gp['bd_boarddir'] = os.path.join(gp['bd_archdir'], 'boards', args.board)
if not os.path.isdir(gp['boarddir']):
log.error(
'ERROR: Board "{board}" not found for architecture "{arch}: exiting'.format(board=args.board, arch=args.arch)
)
choices = sorted(os.listdir(os.path.join(gp['archdir'], 'boards')))
_s = 'ERROR: Board "{board}" not found for architecture "{arch}". Valid choices are "{choices}": exiting'
log.error(_s.format(board = args.board,
arch = args.arch,
choices = '", "'.join(choices)))
sys.exit(1)
if not os.access(gp['boarddir'], os.R_OK):
log.error(
Expand Down

0 comments on commit 6934ddd

Please sign in to comment.