aboutsummaryrefslogtreecommitdiff
path: root/get_common_image_version.py
diff options
context:
space:
mode:
authorLuis Lozano <llozano@chromium.org>2015-12-15 13:49:30 -0800
committerLuis Lozano <llozano@chromium.org>2015-12-16 17:36:06 +0000
commitf2a3ef46f75d2196a93d3ed27f4d1fcf22b54fbe (patch)
tree185d243c7eed7c7a0db6f0e640746cadc1479ea9 /get_common_image_version.py
parent2a66f70fef907c1cb15229cb58e5129cb620ac98 (diff)
downloadtoolchain-utils-f2a3ef46f75d2196a93d3ed27f4d1fcf22b54fbe.tar.gz
Run pyformat on all the toolchain-utils files.
This gets rid of a lot of lint issues. Ran by doing this: for f in *.py; do echo -n "$f " ; if [ -x $f ]; then pyformat -i --remove_trailing_comma --yapf --force_quote_type=double $f ; else pyformat -i --remove_shebang --remove_trailing_comma --yapf --force_quote_type=double $f ; fi ; done BUG=chromium:567921 TEST=Ran simple crosperf run. Change-Id: I59778835fdaa5f706d2e1765924389f9e97433d1 Reviewed-on: https://chrome-internal-review.googlesource.com/242031 Reviewed-by: Luis Lozano <llozano@chromium.org> Commit-Queue: Luis Lozano <llozano@chromium.org> Tested-by: Luis Lozano <llozano@chromium.org> Reviewed-by: Yunlian Jiang <yunlian@google.com>
Diffstat (limited to 'get_common_image_version.py')
-rwxr-xr-xget_common_image_version.py34
1 files changed, 18 insertions, 16 deletions
diff --git a/get_common_image_version.py b/get_common_image_version.py
index cdac8006..bf5d219b 100755
--- a/get_common_image_version.py
+++ b/get_common_image_version.py
@@ -1,7 +1,6 @@
#!/usr/bin/python
#
# Copyright 2013 Google Inc. All Rights Reserved.
-
"""Script to find list of common images (first beta releases) in Chromeos.
Display information about stable ChromeOS/Chrome versions to be used
@@ -11,7 +10,7 @@ using randomly selected versions. Currently we define as a "stable"
version the first Beta release in a particular release cycle.
"""
-__author__ = "llozano@google.com (Luis Lozano)"
+__author__ = 'llozano@google.com (Luis Lozano)'
import optparse
import pickle
@@ -19,13 +18,13 @@ import re
import sys
import urllib
-VERSIONS_HISTORY_URL = "http://cros-omahaproxy.appspot.com/history"
+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', VERSIONS_HISTORY_URL
for beta in betas:
- print " Release", beta["chrome_major_version"], beta
+ print ' Release', beta['chrome_major_version'], beta
return
@@ -36,14 +35,14 @@ def FindAllBetas(all_versions):
prev_beta = {}
for line in all_versions:
match_obj = re.match(
- r"(?P<date>.*),(?P<chromeos_version>.*),"
- r"(?P<chrome_major_version>\d*).(?P<chrome_minor_version>.*),"
- r"(?P<chrome_appid>.*),beta-channel,,Samsung Chromebook Series 5 550",
+ r'(?P<date>.*),(?P<chromeos_version>.*),'
+ r'(?P<chrome_major_version>\d*).(?P<chrome_minor_version>.*),'
+ r'(?P<chrome_appid>.*),beta-channel,,Samsung Chromebook Series 5 550',
line)
if match_obj:
if prev_beta:
- if (prev_beta["chrome_major_version"] !=
- match_obj.group("chrome_major_version")):
+ if (prev_beta['chrome_major_version'] !=
+ match_obj.group('chrome_major_version')):
all_betas.append(prev_beta)
prev_beta = match_obj.groupdict()
if prev_beta:
@@ -52,9 +51,9 @@ def FindAllBetas(all_versions):
def SerializeBetas(all_betas, serialize_file):
- with open(serialize_file, "wb") as f:
+ 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
@@ -62,15 +61,17 @@ 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.")
+ parser.add_option('--serialize',
+ dest='serialize',
+ default=None,
+ help='Save list of common images into the specified file.')
options = parser.parse_args(argv)[0]
try:
opener = urllib.URLopener()
all_versions = opener.open(VERSIONS_HISTORY_URL)
except IOError as ioe:
- print "Cannot open", VERSIONS_HISTORY_URL
+ print 'Cannot open', VERSIONS_HISTORY_URL
print ioe
return 1
@@ -82,6 +83,7 @@ def Main(argv):
return 0
-if __name__ == "__main__":
+
+if __name__ == '__main__':
retval = Main(sys.argv)
sys.exit(retval)