diff options
author | John Vandenberg <jayvdb@gmail.com> | 2015-10-21 07:22:54 +1100 |
---|---|---|
committer | John Vandenberg <jayvdb@gmail.com> | 2015-10-21 07:24:16 +1100 |
commit | c9bb9dd345ba74bab551cde828cde57e45a77609 (patch) | |
tree | f789e335f1bbbb7d693687d2ce5f293dd6ba3104 /_travis | |
parent | 78ed0826668cdb79dea93fe633bacdb0d88de5d7 (diff) | |
download | urllib3-c9bb9dd345ba74bab551cde828cde57e45a77609.tar.gz |
Sync fetch_gae_sdk.py with oauth2client
Diffstat (limited to '_travis')
-rw-r--r-- | _travis/fetch_gae_sdk.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/_travis/fetch_gae_sdk.py b/_travis/fetch_gae_sdk.py index 10d8f0fc..9eb4e1f9 100644 --- a/_travis/fetch_gae_sdk.py +++ b/_travis/fetch_gae_sdk.py @@ -24,6 +24,7 @@ Usage: Current releases are listed here: https://www.googleapis.com/storage/v1/b/appengine-sdks/o?prefix=featured """ +from __future__ import print_function import json import os @@ -32,6 +33,7 @@ import sys import urllib2 import zipfile + _SDK_URL = ( 'https://www.googleapis.com/storage/v1/b/appengine-sdks/o?prefix=featured') @@ -54,28 +56,28 @@ def _version_tuple(v): def get_sdk_urls(sdk_versions): - python_releases = [ - v for v in sdk_versions - if v['name'].startswith('featured/google_appengine')] - current_releases = sorted(python_releases, key=_version_tuple, reverse=True) + python_releases = [v for v in sdk_versions + if v['name'].startswith('featured/google_appengine')] + current_releases = sorted(python_releases, key=_version_tuple, + reverse=True) return [release['mediaLink'] for release in current_releases] def main(argv): if len(argv) > 2: - print 'Usage: {} [<destination_dir>]'.format(argv[0]) + print('Usage: {0} [<destination_dir>]'.format(argv[0])) return 1 dest_dir = argv[1] if len(argv) > 1 else '.' if not os.path.exists(dest_dir): os.makedirs(dest_dir) if os.path.exists(os.path.join(dest_dir, 'google_appengine')): - print 'GAE SDK already installed at {}, exiting.'.format(dest_dir) + print('GAE SDK already installed at {0}, exiting.'.format(dest_dir)) return 0 sdk_versions = get_gae_versions() if not sdk_versions: - print 'Error fetching GAE SDK version info' + print('Error fetching GAE SDK version info') return 1 sdk_urls = get_sdk_urls(sdk_versions) for sdk_url in sdk_urls: @@ -85,16 +87,16 @@ def main(argv): except: pass else: - print 'Could not read SDK from any of ', sdk_urls + print('Could not read SDK from any of ', sdk_urls) return 1 sdk_contents.seek(0) try: zip_contents = zipfile.ZipFile(sdk_contents) zip_contents.extractall(dest_dir) - print 'GAE SDK Installed to {}.'.format(dest_dir) except: - print 'Error extracting SDK contents' + print('Error extracting SDK contents') return 1 + if __name__ == '__main__': sys.exit(main(sys.argv[:])) |