Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: globals/get_browser_versions.py

Issue 5341722020151296: Issue 2628 - Fix stable version of Yandex.Browser listed on the requirements page (Closed)
Left Patch Set: Get both variants and pick newer Created June 3, 2015, 4:37 p.m.
Right Patch Set: Fixed syntax error, removed unneeded list declaration Created June 3, 2015, 5:40 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 import re 1 import re
2 import os 2 import os
3 import sys 3 import sys
4 import json 4 import json
5 import urllib 5 import urllib
6 import errno 6 import errno
7 import logging 7 import logging
8 import time 8 import time
9 from xml.dom import minidom 9 from xml.dom import minidom
10 10
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 get_opera_version('Developer') 125 get_opera_version('Developer')
126 ] 126 ]
127 } 127 }
128 128
129 BROWSERS['opera'] = get_opera_versions 129 BROWSERS['opera'] = get_opera_versions
130 130
131 def key_by_version(version): 131 def key_by_version(version):
132 return map(int, version.split('.')) 132 return map(int, version.split('.'))
133 133
134 def get_yandex_version_raw(suffix, params): 134 def get_yandex_version_raw(suffix, params):
135 response = urllib.urlopen('https://api.browser.yandex.ru/update-info/browser/y andex%s/win-yandex.xml' % (suffix, params)) 135 response = urllib.urlopen('https://api.browser.yandex.ru/update-info/browser/y andex%s/win-yandex.xml%s' % (suffix, params))
Wladimir Palant 2015/06/03 17:11:36 If I'm not mistaken this should produce "not all a
Sebastian Noack 2015/06/03 17:42:31 Argh, you are right. I did test the change, but in
136 try: 136 try:
137 doc = minidom.parse(response) 137 doc = minidom.parse(response)
138 finally: 138 finally:
139 response.close() 139 response.close()
140 140
141 item = doc.getElementsByTagName('item')[0] 141 item = doc.getElementsByTagName('item')[0]
142 description = item.getElementsByTagName('description')[0] 142 description = item.getElementsByTagName('description')[0]
143 return re.search(r'\d+\.\d+', description.firstChild.nodeValue).group(0) 143 return re.search(r'\d+\.\d+', description.firstChild.nodeValue).group(0)
144 144
145 def get_yandex_version(suffix=''): 145 def get_yandex_version(suffix=''):
146 return max( 146 return max(
147 [ 147 get_yandex_version_raw(suffix, ''),
148 get_yandex_version_raw(suffix, ''), 148 get_yandex_version_raw(suffix, '?manual=yes'),
149 get_yandex_version_raw(suffix, '?manual=yes'),
150 ],
151 key=key_by_version 149 key=key_by_version
152 ) 150 )
153 151
154 def get_yandex_versions(): 152 def get_yandex_versions():
155 return { 153 return {
156 'current': get_yandex_version(), 154 'current': get_yandex_version(),
157 'unreleased': [get_yandex_version('-beta')] 155 'unreleased': [get_yandex_version('-beta')]
158 } 156 }
159 157
160 BROWSERS['yandex'] = get_yandex_versions 158 BROWSERS['yandex'] = get_yandex_versions
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 file.seek(0) 227 file.seek(0)
230 json.dump(persistent_cache, file) 228 json.dump(persistent_cache, file)
231 file.truncate() 229 file.truncate()
232 230
233 if not versions['previous']: 231 if not versions['previous']:
234 logging.warning("Couldn't determine previous browser version, " 232 logging.warning("Couldn't determine previous browser version, "
235 'please set %s.previous in %s', browser, filename) 233 'please set %s.previous in %s', browser, filename)
236 234
237 cache[browser] = versions 235 cache[browser] = versions
238 return versions 236 return versions
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld