Index: globals/get_browser_versions.py |
=================================================================== |
--- a/globals/get_browser_versions.py |
+++ b/globals/get_browser_versions.py |
@@ -25,78 +25,78 @@ |
<app appid="{4DC8B4CA-1BDA-483E-B5FA-D3C12E15B62D}" ap="x64-dev-multi-chrome"> |
<updatecheck/> |
</app> |
</request>''' |
cache = {} |
-def get_mozilla_version(product, origin_version, channel, |
- minor=False, subdomain='aus4', origin_build='-', |
- attribute='appVersion', platform='WINNT_x86-msvc'): |
- response = urllib.urlopen('https://%s.mozilla.org/update/3/%s/%s/%s/%s/en-US/%s/-/default/default/update.xml?force=1' % ( |
- subdomain, |
- product, |
- origin_version, |
- origin_build, |
- platform, |
- channel |
- )) |
+def get_json_versions(product): |
+ urls = { |
Vasily Kuznetsov
2016/08/22 17:51:55
This dict seems somewhat redundant here. Wouldn't
Jon Sonesen
2016/08/29 13:15:39
So rather than a constant dict just have the funct
|
+ 'Firefox': |
+ 'https://product-details.mozilla.org/1.0/firefox_versions.json', |
+ 'Thunderbird': |
+ 'https://product-details.mozilla.org/1.0/thunderbird_versions.json', |
+ 'Seamonkey': |
+ 'http://www.seamonkey-project.org/seamonkey_versions.json' |
+ } |
+ response = urllib.urlopen(urls[product]) |
try: |
- doc = minidom.parse(response) |
+ doc = json.load(response) |
+ except json.ValueError: |
+ print 'URL: %s not returning json object'.format(urls[product]) |
finally: |
response.close() |
- updates = doc.getElementsByTagName('update') |
- if not updates: |
- raise Exception('No updates for %s in %s channel' % (product, channel)) |
- full_version = updates[0].getAttribute(attribute) |
- |
- match = re.search(r'^(\d+)(?:\.\d+)?', full_version) |
- if minor: |
- return match.group(0) |
- return match.group(1) |
+ for key, value in doc.iteritems(): |
+ if value: |
+ doc[key] = re.search(r'^(\d+)(?:\.\d+)?', value).group(0) |
Vasily Kuznetsov
2016/08/22 17:51:55
Isn't this a bit fragile? What if the regex doesn'
Jon Sonesen
2016/08/29 13:15:39
I agree that it is fragile...but also I thought we
|
+ return doc |
-def get_mozilla_versions(product, origin_version, release_minor=False): |
+def get_firefox_versions(): |
+ versions = get_json_versions('Firefox') |
return { |
- 'current': get_mozilla_version(product, origin_version, 'release', release_minor), |
+ 'current': versions['LATEST_FIREFOX_VERSION'], |
+ 'unreleased': [ |
+ versions['LATEST_FIREFOX_DEVEL_VERSION'], |
Vasily Kuznetsov
2016/08/22 17:51:55
It would be nice to give more friendly error messa
Jon Sonesen
2016/08/29 13:15:39
I thought we decided not to so the build 'fails lo
|
+ versions['FIREFOX_AURORA'], |
+ versions['FIREFOX_NIGHTLY'], |
+ ] |
+ } |
+ |
+ |
+def get_thunderbird_versions(): |
+ versions = get_json_versions('Thunderbird') |
+ firefox_versions = get_json_versions('Firefox') |
+ return { |
+ 'current': versions['LATEST_THUNDERBIRD_VERSION'], |
'unreleased': [ |
- get_mozilla_version(product, origin_version, 'beta'), |
- get_mozilla_version(product, origin_version, 'aurora'), |
- get_mozilla_version(product, origin_version, 'nightly'), |
+ versions['LATEST_THUNDERBIRD_DEVEL_VERSION'], |
+ versions['LATEST_THUNDERBIRD_ALPHA'], |
Vasily Kuznetsov
2016/08/22 17:51:55
I think this should be LATEST_THUNDERBIRD_ALPHA_VE
Jon Sonesen
2016/08/29 13:15:39
you're right....dang haha
|
+ firefox_versions['FIREFOX_NIGHTLY'], |
] |
} |
-BROWSERS['firefox'] = lambda: get_mozilla_versions('Firefox', '37.0') |
-BROWSERS['thunderbird'] = lambda: get_mozilla_versions('Thunderbird', '31.0', True) |
- |
- |
-def get_seamonkey_version(origin_version, origin_build, channel, **kw): |
- return get_mozilla_version('SeaMonkey', origin_version, channel, True, |
- 'aus2-community', origin_build, 'version', **kw) |
+BROWSERS['firefox'] = lambda: get_firefox_versions() |
+BROWSERS['thunderbird'] = lambda: get_thunderbird_versions() |
def get_seamonkey_versions(): |
+ seamonkey_versions = get_json_versions('Seamonkey') |
versions = { |
- 'current': get_seamonkey_version('2.32', '20150112201917', 'release'), |
- 'unreleased': [get_seamonkey_version('2.32', '20150101215737', 'beta')] |
+ 'current': seamonkey_versions['LATEST_SEAMONKEY_VERSION'], |
+ 'unreleased': [ |
+ seamonkey_versions['LATEST_SEAMONKEY_MILESTONE_VERSION'], |
+ seamonkey_versions['LATEST_SEAMONKEY_TESTING_VERSION'], |
+ seamonkey_versions['LATEST_SEAMONKEY_DEVEL_VERSION'], |
+ ] |
} |
- # Aurora and Nightly builds for Windows are permantently broken. |
- # Occasionally, builds for other platforms are broken as well. |
- # https://bugzilla.mozilla.org/show_bug.cgi?id=1086553 |
- for channel in ('aurora', 'nightly'): |
- try: |
- version = get_seamonkey_version('2.32', '-', channel, platform='Linux_x86-gcc3') |
- except Exception: |
- continue |
- versions['unreleased'].append(version) |
- |
return versions |
BROWSERS['seamonkey'] = get_seamonkey_versions |
def get_chrome_version(manifest): |
return manifest.getAttribute('version').split('.')[0] |