From 4e531f64c66f99b5d872a7aa0e62d90e2624dad4 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Fri, 17 Feb 2017 16:00:12 -0800 Subject: [PATCH] make download_android_tools fail when the download fails (#8261) --- dev/bots/download_android_tools.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/dev/bots/download_android_tools.py b/dev/bots/download_android_tools.py index 1fdfa40d16..eca818da3c 100755 --- a/dev/bots/download_android_tools.py +++ b/dev/bots/download_android_tools.py @@ -62,7 +62,7 @@ def UpdateTools(tools_name): version = f.read().strip() # Return if installed binaries are up to date. if version == GetInstalledVersion(version_stamp): - return + return True # Remove the old install directory checked out from git. if os.path.exists(os.path.join(INSTALL_DIR, '.git')): @@ -82,7 +82,7 @@ def UpdateTools(tools_name): archive_path] if not RunCommand(download_cmd): print ('WARNING: Failed to download Android tools.') - return + return False print "Extracting Android tools (" + tools_name + ")" with tarfile.open(archive_path) as arch: @@ -91,6 +91,7 @@ def UpdateTools(tools_name): # Write version as the last step. with open(os.path.join(INSTALL_DIR, version_stamp), 'w+') as f: f.write('%s\n' % version) + return True def main(argv): option_parser = optparse.OptionParser() @@ -110,10 +111,13 @@ def main(argv): option_parser.print_help() sys.exit(1) - if options.type in ('sdk', 'both'): - UpdateTools('sdk') - if options.type in ('ndk', 'both'): - UpdateTools('ndk') + if options.type in ('sdk', 'both') and not UpdateTools('sdk'): + print ('ERROR: Failed to download sdk.') + sys.exit(1) + + if options.type in ('ndk', 'both') and not UpdateTools('ndk'): + print ('ERROR: Failed to download ndk.') + sys.exit(1) if __name__ == '__main__': sys.exit(main(sys.argv))