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

Side by Side Diff: globals/get_browser_versions.py

Issue 29720671: Noissue - Updated requirements page, removed legacy Gecko apps, added Safari 11 (Closed)
Patch Set: Created March 12, 2018, 11:49 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | pages/requirements.tmpl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 from jinja2 import contextfunction 11 from jinja2 import contextfunction
12 12
13 BROWSERS = {} 13 BROWSERS = {}
14 BASE_URL = 'https://product-details.mozilla.org/1.0' 14 BASE_URL = 'https://product-details.mozilla.org/1.0'
15 FIREFOX_URL = BASE_URL + '/firefox_versions.json' 15 FIREFOX_URL = BASE_URL + '/firefox_versions.json'
16 THUNDERBIRD_URL = BASE_URL + '/thunderbird_versions.json'
17 SEAMONKEY_URL = 'http://www.seamonkey-project.org/seamonkey_versions.json'
18 CHROME_URL = 'https://omahaproxy.appspot.com/all.json?os=win' 16 CHROME_URL = 'https://omahaproxy.appspot.com/all.json?os=win'
19 17
20 cache = {} 18 cache = {}
21 19
22 20
23 def get_json_versions(product_url): 21 def get_json_versions(product_url):
24 response = urllib.urlopen(product_url) 22 response = urllib.urlopen(product_url)
25 try: 23 try:
26 doc = json.load(response) 24 doc = json.load(response)
27 except json.ValueError: 25 except json.ValueError:
(...skipping 12 matching lines...) Expand all
40 def get_firefox_versions(): 38 def get_firefox_versions():
41 versions = get_json_versions(FIREFOX_URL) 39 versions = get_json_versions(FIREFOX_URL)
42 return { 40 return {
43 'current': versions['LATEST_FIREFOX_VERSION'], 41 'current': versions['LATEST_FIREFOX_VERSION'],
44 'unreleased': [ 42 'unreleased': [
45 versions['LATEST_FIREFOX_DEVEL_VERSION'], 43 versions['LATEST_FIREFOX_DEVEL_VERSION'],
46 versions['FIREFOX_NIGHTLY'], 44 versions['FIREFOX_NIGHTLY'],
47 ] 45 ]
48 } 46 }
49 47
50
51 def get_thunderbird_versions():
52 tbird_versions = get_json_versions(THUNDERBIRD_URL)
53 firefox_versions = get_json_versions(FIREFOX_URL)
54 return {
55 'current': tbird_versions['LATEST_THUNDERBIRD_VERSION'],
56 'unreleased': [
57 tbird_versions['LATEST_THUNDERBIRD_DEVEL_VERSION'],
58 tbird_versions['LATEST_THUNDERBIRD_ALPHA_VERSION'],
59 firefox_versions['FIREFOX_NIGHTLY'],
60 ]
61 }
62
63 BROWSERS['firefox'] = lambda: get_firefox_versions() 48 BROWSERS['firefox'] = lambda: get_firefox_versions()
64 BROWSERS['thunderbird'] = lambda: get_thunderbird_versions()
65
66
67 def get_seamonkey_versions():
68 seamonkey_versions = get_json_versions(SEAMONKEY_URL)
69 versions = {
70 'current': seamonkey_versions['LATEST_SEAMONKEY_VERSION'],
71 'unreleased': [
72 seamonkey_versions['LATEST_SEAMONKEY_MILESTONE_VERSION'],
73 seamonkey_versions['LATEST_SEAMONKEY_DEVEL_VERSION'],
74 ]
75 }
76
77 return versions
78
79 BROWSERS['seamonkey'] = get_seamonkey_versions
80 49
81 50
82 def get_chrome_versions(): 51 def get_chrome_versions():
83 response = urllib.urlopen(CHROME_URL) 52 response = urllib.urlopen(CHROME_URL)
84 try: 53 try:
85 data = json.load(response) 54 data = json.load(response)
86 finally: 55 finally:
87 response.close() 56 response.close()
88 57
89 versions = { 58 versions = {
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 file.seek(0) 196 file.seek(0)
228 json.dump(persistent_cache, file) 197 json.dump(persistent_cache, file)
229 file.truncate() 198 file.truncate()
230 199
231 if not versions['previous']: 200 if not versions['previous']:
232 logging.warning("Couldn't determine previous browser version, " 201 logging.warning("Couldn't determine previous browser version, "
233 'please set %s.previous in %s', browser, filename) 202 'please set %s.previous in %s', browser, filename)
234 203
235 cache[browser] = versions 204 cache[browser] = versions
236 return versions 205 return versions
OLDNEW
« no previous file with comments | « no previous file | pages/requirements.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld