Left: | ||
Right: |
OLD | NEW |
---|---|
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 12 matching lines...) Expand all Loading... | |
23 <updatecheck/> | 23 <updatecheck/> |
24 </app> | 24 </app> |
25 <app appid="{4DC8B4CA-1BDA-483E-B5FA-D3C12E15B62D}" ap="x64-dev-multi-chrome"> | 25 <app appid="{4DC8B4CA-1BDA-483E-B5FA-D3C12E15B62D}" ap="x64-dev-multi-chrome"> |
26 <updatecheck/> | 26 <updatecheck/> |
27 </app> | 27 </app> |
28 </request>''' | 28 </request>''' |
29 | 29 |
30 cache = {} | 30 cache = {} |
31 | 31 |
32 | 32 |
33 def get_mozilla_version(product, origin_version, channel, | 33 def get_json_versions(product): |
34 minor=False, subdomain='aus4', origin_build='-', | 34 urls = { |
35 attribute='appVersion', platform='WINNT_x86-msvc'): | 35 'Firefox': |
36 response = urllib.urlopen('https://%s.mozilla.org/update/3/%s/%s/%s/%s/en-US /%s/-/default/default/update.xml?force=1' % ( | 36 'https://product-details.mozilla.org/firefox_versions.json', |
Wladimir Palant
2016/08/12 11:40:55
Gotta love it - the URL changed into https://produ
Jon Sonesen
2016/08/16 02:27:54
will update :D
| |
37 subdomain, | 37 'Thunderbird': |
38 product, | 38 'https://product-details.mozilla.org/thunderbird_versions.json', |
39 origin_version, | 39 'Seamonkey': |
40 origin_build, | 40 'http://www.seamonkey-project.org/seamonkey_versions.json' |
41 platform, | 41 } |
42 channel | 42 response = urllib.urlopen(urls[product]) |
43 )) | |
44 try: | 43 try: |
45 doc = minidom.parse(response) | 44 doc = json.load(response.read()) |
46 finally: | 45 finally: |
47 response.close() | 46 response.close() |
48 | 47 return doc |
49 updates = doc.getElementsByTagName('update') | |
50 if not updates: | |
51 raise Exception('No updates for %s in %s channel' % (product, channel)) | |
52 full_version = updates[0].getAttribute(attribute) | |
53 | |
54 match = re.search(r'^(\d+)(?:\.\d+)?', full_version) | |
55 if minor: | |
56 return match.group(0) | |
57 return match.group(1) | |
58 | 48 |
59 | 49 |
60 def get_mozilla_versions(product, origin_version, release_minor=False): | 50 def get_firefox_versions(): |
51 versions = get_json_versions('Firefox') | |
61 return { | 52 return { |
62 'current': get_mozilla_version(product, origin_version, 'release', relea se_minor), | 53 'current': versions['LATEST_FIREFOX_VERSION'], |
54 'unreleased': [ | |
55 versions['LATEST_FIREFOX_DEVEL_VERSION'], | |
56 versions['FIREFOX_AURORA'], | |
57 versions['FIREFOX_NIGHTLY'], | |
Wladimir Palant
2016/08/12 11:40:55
We need to remove the "a1" and similar suffixes fr
Jon Sonesen
2016/08/16 02:27:54
Just to clarify; do you mean that I should remove
Wladimir Palant
2016/08/16 10:40:17
The code you are replacing here was using r'^(\d+)
Jon Sonesen
2016/08/16 18:46:09
Thank you, also I added a log statement in case th
| |
58 ] | |
59 } | |
60 | |
61 | |
62 def get_thunderbird_versions(): | |
63 versions = get_json_versions('Thunderbird') | |
64 firefox_versions = get_json_versions('Firefox') | |
65 return { | |
66 'current': versions['LATEST_THUNDERBIRD_VERSION'], | |
63 'unreleased': [ | 67 'unreleased': [ |
64 get_mozilla_version(product, origin_version, 'beta'), | 68 versions['LATEST_THUNDERBIRD_DEVEL_VERSION'], |
65 get_mozilla_version(product, origin_version, 'aurora'), | 69 firefox_versions['FIREFOX_AURORA'], |
66 get_mozilla_version(product, origin_version, 'nightly'), | 70 firefox_versions['FIREFOX_NIGHTLY'], |
Wladimir Palant
2016/08/12 11:40:55
There is LATEST_THUNDERBIRD_ALPHA_VERSION in the d
Jon Sonesen
2016/08/16 02:27:54
Will use that instead.
| |
67 ] | 71 ] |
68 } | 72 } |
69 | 73 |
70 BROWSERS['firefox'] = lambda: get_mozilla_versions('Firefox', '37.0') | 74 BROWSERS['firefox'] = lambda: get_firefox_versions() |
71 BROWSERS['thunderbird'] = lambda: get_mozilla_versions('Thunderbird', '31.0', Tr ue) | 75 BROWSERS['thunderbird'] = lambda: get_thunderbird_versions() |
72 | |
73 | |
74 def get_seamonkey_version(origin_version, origin_build, channel, **kw): | |
75 return get_mozilla_version('SeaMonkey', origin_version, channel, True, | |
76 'aus2-community', origin_build, 'version', **kw) | |
77 | 76 |
78 | 77 |
79 def get_seamonkey_versions(): | 78 def get_seamonkey_versions(): |
80 versions = { | |
81 'current': get_seamonkey_version('2.32', '20150112201917', 'release'), | |
82 'unreleased': [get_seamonkey_version('2.32', '20150101215737', 'beta')] | |
83 } | |
84 | |
85 # Aurora and Nightly builds for Windows are permantently broken. | 79 # Aurora and Nightly builds for Windows are permantently broken. |
86 # Occasionally, builds for other platforms are broken as well. | 80 # Occasionally, builds for other platforms are broken as well. |
87 # https://bugzilla.mozilla.org/show_bug.cgi?id=1086553 | 81 # https://bugzilla.mozilla.org/show_bug.cgi?id=1086553 |
Wladimir Palant
2016/08/12 11:40:55
This comment no longer makes sense, it doesn't mat
| |
88 for channel in ('aurora', 'nightly'): | 82 seamonkey_versions = get_json_versions('Seamonkey') |
89 try: | 83 versions = { |
90 version = get_seamonkey_version('2.32', '-', channel, platform='Linu x_x86-gcc3') | 84 'current': seamonkey_versions['LATEST_SEAMONKEY_VERSION'], |
91 except Exception: | 85 'unreleased': [ |
92 continue | 86 seamonkey_versions['LATEST_SEAMONKEY_DEVEL_VERSION'], |
Wladimir Palant
2016/08/12 11:40:55
This should be the last entry in the list since it
| |
93 versions['unreleased'].append(version) | 87 seamonkey_versions['LATEST_SEAMONKEY_MILESTONE_VERSION'], |
88 seamonkey_versions['LATEST_SEAMONKEY_TESTING_VERSION'], | |
89 ] | |
90 } | |
94 | 91 |
95 return versions | 92 return versions |
96 | 93 |
97 BROWSERS['seamonkey'] = get_seamonkey_versions | 94 BROWSERS['seamonkey'] = get_seamonkey_versions |
98 | 95 |
99 | 96 |
100 def get_chrome_version(manifest): | 97 def get_chrome_version(manifest): |
101 return manifest.getAttribute('version').split('.')[0] | 98 return manifest.getAttribute('version').split('.')[0] |
102 | 99 |
103 | 100 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
245 file.seek(0) | 242 file.seek(0) |
246 json.dump(persistent_cache, file) | 243 json.dump(persistent_cache, file) |
247 file.truncate() | 244 file.truncate() |
248 | 245 |
249 if not versions['previous']: | 246 if not versions['previous']: |
250 logging.warning("Couldn't determine previous browser version, " | 247 logging.warning("Couldn't determine previous browser version, " |
251 'please set %s.previous in %s', browser, filename) | 248 'please set %s.previous in %s', browser, filename) |
252 | 249 |
253 cache[browser] = versions | 250 cache[browser] = versions |
254 return versions | 251 return versions |
OLD | NEW |