Improve error handling for barcode_tools

These changes make the execution abort earlier on an error (like a tool is not found) and makes it easier to figure out what's wrong.

Made build_zxing.py executable.

BUG=None
TEST=Local runs of the PyAuto test src/chrome/test/functional/webrtc_video_quality.py in Chromium.

Review URL: https://webrtc-codereview.appspot.com/840005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@2899 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
kjellander@webrtc.org
2012-10-10 16:11:28 +00:00
parent ff33bdd9d7
commit ccb52c2961
4 changed files with 29 additions and 19 deletions

View File

@@ -55,7 +55,7 @@ def run_shell_command(command, msg=None):
output, error = process.communicate()
if process.returncode != 0:
if msg:
print msg
print >> sys.stderr, msg
raise HelperError('Failed to run %s: command returned %d and printed '
'%s and %s' % (cmd, process.returncode, output, error))
return output.strip()
@@ -90,7 +90,8 @@ def perform_action_on_all_files(directory, file_pattern, file_extension,
file_pattern(string): The name pattern of the files.
file_extension(string): The files' extension.
start_number(int): From where to start to count frames.
action(function): The action to be performed over the files.
action(function): The action to be performed over the files. Must return
False if the action failed, True otherwise.
Return:
(bool): Whether performing the action over all files was successful or not.
@@ -106,6 +107,7 @@ def perform_action_on_all_files(directory, file_pattern, file_extension,
if os.path.isfile(file_name):
if not action(file_name=file_name, **kwargs):
errors = True
break
file_number += 1
else:
file_exists = False