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

Unified Diff: globals/get_browser_versions.py

Issue 5341722020151296: Issue 2628 - Fix stable version of Yandex.Browser listed on the requirements page (Closed)
Patch Set: Fixed syntax error, removed unneeded list declaration Created June 3, 2015, 5:40 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: globals/get_browser_versions.py
===================================================================
--- a/globals/get_browser_versions.py
+++ b/globals/get_browser_versions.py
@@ -128,8 +128,11 @@
BROWSERS['opera'] = get_opera_versions
-def get_yandex_version(suffix):
- response = urllib.urlopen('https://api.browser.yandex.ru/update-info/browser/yandex%s/win-yandex.xml' % suffix)
+def key_by_version(version):
+ return map(int, version.split('.'))
+
+def get_yandex_version_raw(suffix, params):
+ response = urllib.urlopen('https://api.browser.yandex.ru/update-info/browser/yandex%s/win-yandex.xml%s' % (suffix, params))
try:
doc = minidom.parse(response)
finally:
@@ -139,9 +142,16 @@
description = item.getElementsByTagName('description')[0]
return re.search(r'\d+\.\d+', description.firstChild.nodeValue).group(0)
+def get_yandex_version(suffix=''):
+ return max(
+ get_yandex_version_raw(suffix, ''),
+ get_yandex_version_raw(suffix, '?manual=yes'),
+ key=key_by_version
+ )
+
def get_yandex_versions():
return {
- 'current': get_yandex_version(''),
+ 'current': get_yandex_version(),
'unreleased': [get_yandex_version('-beta')]
}
@@ -209,7 +219,7 @@
# to list each version only once.
versions['unreleased'] = sorted(
set(versions['unreleased']) - {current, previous},
- key=lambda ver: map(int, ver.split('.'))
+ key=key_by_version
)
versions['timestamp'] = now
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld