aboutsummaryrefslogtreecommitdiff
path: root/get_common_image_version.py
diff options
context:
space:
mode:
authorCaroline Tice <cmtice@google.com>2016-01-13 09:48:29 -0800
committerchrome-bot <chrome-bot@chromium.org>2016-01-22 19:30:55 +0000
commit88272d479f2761cc1906fea564c73033f77a6270 (patch)
tree4da9c114d64522f59494a908cf9a85b09c994d32 /get_common_image_version.py
parent439f2b77c86987362f53bd4f6e39896aa6d77f66 (diff)
downloadtoolchain-utils-88272d479f2761cc1906fea564c73033f77a6270.tar.gz
Fix cros lint errors.
Also move deprecated scripts to the 'deprecated' directory. BUG=chromiumos:570464 TEST=tested scripts to make sure they still work. Change-Id: I3442a86d898104591233a0849ea0bafb52ecf1f7 Reviewed-on: https://chrome-internal-review.googlesource.com/244221 Commit-Ready: Caroline Tice <cmtice@google.com> Tested-by: Caroline Tice <cmtice@google.com> Reviewed-by: Yunlian Jiang <yunlian@google.com>
Diffstat (limited to 'get_common_image_version.py')
-rwxr-xr-xget_common_image_version.py31
1 files changed, 17 insertions, 14 deletions
diff --git a/get_common_image_version.py b/get_common_image_version.py
index bf5d219b..da36b98f 100755
--- a/get_common_image_version.py
+++ b/get_common_image_version.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
#
# Copyright 2013 Google Inc. All Rights Reserved.
"""Script to find list of common images (first beta releases) in Chromeos.
@@ -10,9 +10,11 @@ using randomly selected versions. Currently we define as a "stable"
version the first Beta release in a particular release cycle.
"""
+from __future__ import print_function
+
__author__ = 'llozano@google.com (Luis Lozano)'
-import optparse
+import argparse
import pickle
import re
import sys
@@ -22,9 +24,9 @@ VERSIONS_HISTORY_URL = 'http://cros-omahaproxy.appspot.com/history'
def DisplayBetas(betas):
- print 'List of betas from', VERSIONS_HISTORY_URL
+ print('List of betas from %s' % VERSIONS_HISTORY_URL)
for beta in betas:
- print ' Release', beta['chrome_major_version'], beta
+ print(' Release', beta['chrome_major_version'], beta)
return
@@ -53,26 +55,27 @@ def FindAllBetas(all_versions):
def SerializeBetas(all_betas, serialize_file):
with open(serialize_file, 'wb') as f:
pickle.dump(all_betas, f)
- print 'Serialized list of betas into', serialize_file
+ print('Serialized list of betas into', serialize_file)
return
def Main(argv):
"""Get ChromeOS first betas list from history URL."""
- parser = optparse.OptionParser()
- parser.add_option('--serialize',
- dest='serialize',
- default=None,
- help='Save list of common images into the specified file.')
- options = parser.parse_args(argv)[0]
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--serialize',
+ dest='serialize',
+ default=None,
+ help='Save list of common images into the specified '
+ 'file.')
+ options = parser.parse_args(argv)
try:
opener = urllib.URLopener()
all_versions = opener.open(VERSIONS_HISTORY_URL)
except IOError as ioe:
- print 'Cannot open', VERSIONS_HISTORY_URL
- print ioe
+ print('Cannot open', VERSIONS_HISTORY_URL)
+ print(ioe)
return 1
all_betas = FindAllBetas(all_versions)
@@ -85,5 +88,5 @@ def Main(argv):
if __name__ == '__main__':
- retval = Main(sys.argv)
+ retval = Main(sys.argv[1:])
sys.exit(retval)