diff options
author | Stevan Radakovic <stevan.radakovic@linaro.org> | 2013-02-25 19:18:09 +0100 |
---|---|---|
committer | Stevan Radakovic <stevan.radakovic@linaro.org> | 2013-02-25 19:18:09 +0100 |
commit | 273c0627eb37a5b308d7d19c0bceec62a2954827 (patch) | |
tree | 51abaa3e1bd1d2fd8bfb5afdbf0d84dc121fb490 /linaro-media-create | |
parent | 1be85e477d93e72ba9d1e36f2c444dd3fc28dfdf (diff) |
Sort out exception handling when CommandNotFound is not present.
Diffstat (limited to 'linaro-media-create')
-rwxr-xr-x | linaro-media-create | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/linaro-media-create b/linaro-media-create index 39f1f6c..2871614 100755 --- a/linaro-media-create +++ b/linaro-media-create @@ -98,8 +98,13 @@ def ensure_required_commands(args): required_commands.append('mkfs.%s' % args.rootfs) else: raise AssertionError('Unsupported rootfs type %s' % args.rootfs) + for command in required_commands: - ensure_command(command) + try: + ensure_command(command) + except UnableToFindPackageProvidingCommand: + logger.error("Could not look up command %s. Please ensure that command %s is installed." % (command, command)) + raise if __name__ == '__main__': @@ -177,7 +182,10 @@ if __name__ == '__main__': ROOTFS_DIR = os.path.join(BIN_DIR, filesystem_dir) - ensure_required_commands(args) + try: + ensure_required_commands(args) + except UnableToFindPackageProvidingCommand: + sys.exit(1) sig_file_list = args.hwpacksigs[:] if args.binarysig is not None: |