LEFT | RIGHT |
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 urllib2 | 5 import urllib2 |
6 import errno | 6 import errno |
7 import logging | 7 import logging |
8 from xml.dom import minidom | 8 from xml.dom import minidom |
9 | 9 |
10 from jinja2 import contextfunction | 10 from jinja2 import contextfunction |
(...skipping 11 matching lines...) Expand all Loading... |
22 <updatecheck/> | 22 <updatecheck/> |
23 </app> | 23 </app> |
24 <app appid="{4DC8B4CA-1BDA-483E-B5FA-D3C12E15B62D}" ap="x64-dev-multi-chrome"> | 24 <app appid="{4DC8B4CA-1BDA-483E-B5FA-D3C12E15B62D}" ap="x64-dev-multi-chrome"> |
25 <updatecheck/> | 25 <updatecheck/> |
26 </app> | 26 </app> |
27 </request>''' | 27 </request>''' |
28 | 28 |
29 def get_mozilla_version(product, origin_version, channel, | 29 def get_mozilla_version(product, origin_version, channel, |
30 minor=False, subdomain='aus4', origin_build='-', | 30 minor=False, subdomain='aus4', origin_build='-', |
31 attribute='appVersion', platform='WINNT_x86-msvc'): | 31 attribute='appVersion', platform='WINNT_x86-msvc'): |
32 url = 'https://%s.mozilla.org/update/3/%s/%s/%s/%s/en-US/%s/-/default/default/
update.xml?force=1' % ( | 32 response = urllib2.urlopen('https://%s.mozilla.org/update/3/%s/%s/%s/%s/en-US/
%s/-/default/default/update.xml?force=1' % ( |
33 subdomain, | 33 subdomain, |
34 product, | 34 product, |
35 origin_version, | 35 origin_version, |
36 origin_build, | 36 origin_build, |
37 platform, | 37 platform, |
38 channel | 38 channel |
39 ) | 39 )) |
40 print url | |
41 response = urllib2.urlopen(url) | |
42 try: | 40 try: |
43 doc = minidom.parse(response) | 41 doc = minidom.parse(response) |
44 finally: | 42 finally: |
45 response.close() | 43 response.close() |
46 | 44 |
47 update = doc.getElementsByTagName('update')[0] | 45 update = doc.getElementsByTagName('update')[0] |
48 full_version = update.getAttribute(attribute) | 46 full_version = update.getAttribute(attribute) |
49 | 47 |
50 match = re.search(r'^(\d+)(?:\.\d+)?', full_version) | 48 match = re.search(r'^(\d+)(?:\.\d+)?', full_version) |
51 if minor: | 49 if minor: |
(...skipping 11 matching lines...) Expand all Loading... |
63 } | 61 } |
64 | 62 |
65 BROWSERS['firefox'] = lambda: get_mozilla_versions('Firefox', '37.0') | 63 BROWSERS['firefox'] = lambda: get_mozilla_versions('Firefox', '37.0') |
66 BROWSERS['thunderbird'] = lambda: get_mozilla_versions('Thunderbird', '31.0', Tr
ue) | 64 BROWSERS['thunderbird'] = lambda: get_mozilla_versions('Thunderbird', '31.0', Tr
ue) |
67 | 65 |
68 def get_seamonkey_version(origin_version, origin_build, channel, **kw): | 66 def get_seamonkey_version(origin_version, origin_build, channel, **kw): |
69 return get_mozilla_version('SeaMonkey', origin_version, channel, True, | 67 return get_mozilla_version('SeaMonkey', origin_version, channel, True, |
70 'aus2-community', origin_build, 'version', **kw) | 68 'aus2-community', origin_build, 'version', **kw) |
71 | 69 |
72 def get_seamonkey_versions(): | 70 def get_seamonkey_versions(): |
73 versions = { | 71 return { |
74 'current': get_seamonkey_version('2.32', '20150112201917', 'release'), | 72 'current': get_seamonkey_version('2.32', '20150112201917', 'release'), |
75 'unreleased': [get_seamonkey_version('2.32', '20150101215737', 'beta')] | 73 'unreleased': [ |
76 } | 74 get_seamonkey_version('2.32', '20150101215737', 'beta'), |
77 | 75 |
78 # Aurora builds for Windows, and Nighlies for all platforms | 76 # Aurora and Nightly builds for Windows are currently broken. |
79 # are currently broken, and don't seem to come back soon. | 77 # https://bugzilla.mozilla.org/show_bug.cgi?id=1086553 |
80 # https://bugzilla.mozilla.org/show_bug.cgi?id=1086553 | 78 get_seamonkey_version('2.32', '-', 'aurora', platform='Linux_x86-gcc3'), |
81 for channel in ('aurora', 'nightly'): | 79 get_seamonkey_version('2.32', '-', 'nightly', platform='Linux_x86-gcc3') |
82 try: | 80 ] |
83 version = get_seamonkey_version('2.13.1', '20120909051705', channel, platf
orm='Linux_x86-gcc3') | 81 } |
84 except Exception: | |
85 continue | |
86 versions['unreleased'].append(version) | |
87 | |
88 return versions | |
89 | 82 |
90 BROWSERS['seamonkey'] = get_seamonkey_versions | 83 BROWSERS['seamonkey'] = get_seamonkey_versions |
91 | 84 |
92 def get_chrome_version(manifest): | 85 def get_chrome_version(manifest): |
93 return manifest.getAttribute('version').split('.')[0] | 86 return manifest.getAttribute('version').split('.')[0] |
94 | 87 |
95 def get_chrome_versions(): | 88 def get_chrome_versions(): |
96 response = urllib2.urlopen(urllib2.Request('https://tools.google.com/service/u
pdate2', CHROME_UPDATE_XML)) | 89 response = urllib2.urlopen(urllib2.Request('https://tools.google.com/service/u
pdate2', CHROME_UPDATE_XML)) |
97 try: | 90 try: |
98 doc = minidom.parse(response) | 91 doc = minidom.parse(response) |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 cache[browser] = versions | 201 cache[browser] = versions |
209 file.seek(0) | 202 file.seek(0) |
210 json.dump(cache, file) | 203 json.dump(cache, file) |
211 file.truncate() | 204 file.truncate() |
212 | 205 |
213 if not versions['previous']: | 206 if not versions['previous']: |
214 logging.warning("Couldn't determine previous browser version, " | 207 logging.warning("Couldn't determine previous browser version, " |
215 'please set %s.previous in %s', browser, filename) | 208 'please set %s.previous in %s', browser, filename) |
216 | 209 |
217 return versions | 210 return versions |
LEFT | RIGHT |