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

Side by Side Diff: globals/get_browser_versions.py

Issue 29321106: Issue 2723 - Raise a more detailed exception when there is no update for Mozilla products (Closed)
Patch Set: Created June 25, 2015, 1:24 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 | no next file » | 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
(...skipping 27 matching lines...) Expand all
38 origin_version, 38 origin_version,
39 origin_build, 39 origin_build,
40 platform, 40 platform,
41 channel 41 channel
42 )) 42 ))
43 try: 43 try:
44 doc = minidom.parse(response) 44 doc = minidom.parse(response)
45 finally: 45 finally:
46 response.close() 46 response.close()
47 47
48 update = doc.getElementsByTagName('update')[0] 48 updates = doc.getElementsByTagName('update')
49 full_version = update.getAttribute(attribute) 49 if not updates:
50 raise Exception('No updates for %s in %s channel' % (product, channel))
51 full_version = updates[0].getAttribute(attribute)
50 52
51 match = re.search(r'^(\d+)(?:\.\d+)?', full_version) 53 match = re.search(r'^(\d+)(?:\.\d+)?', full_version)
52 if minor: 54 if minor:
53 return match.group(0) 55 return match.group(0)
54 return match.group(1) 56 return match.group(1)
55 57
56 def get_mozilla_versions(product, origin_version, release_minor=False): 58 def get_mozilla_versions(product, origin_version, release_minor=False):
57 return { 59 return {
58 'current': get_mozilla_version(product, origin_version, 'release', release_m inor), 60 'current': get_mozilla_version(product, origin_version, 'release', release_m inor),
59 'unreleased': [ 61 'unreleased': [
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 file.seek(0) 231 file.seek(0)
230 json.dump(persistent_cache, file) 232 json.dump(persistent_cache, file)
231 file.truncate() 233 file.truncate()
232 234
233 if not versions['previous']: 235 if not versions['previous']:
234 logging.warning("Couldn't determine previous browser version, " 236 logging.warning("Couldn't determine previous browser version, "
235 'please set %s.previous in %s', browser, filename) 237 'please set %s.previous in %s', browser, filename)
236 238
237 cache[browser] = versions 239 cache[browser] = versions
238 return versions 240 return versions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld