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

Delta Between Two Patch Sets: packagerGecko.py

Issue 4777306409140224: Issue 2607 - Clear currentVersion on uninstallation (Closed)
Left Patch Set: Created May 29, 2015, 4:32 p.m.
Right Patch Set: Use json.loads rather than re.search Created May 29, 2015, 8:02 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # coding: utf-8 1 # coding: utf-8
2 2
3 # This Source Code Form is subject to the terms of the Mozilla Public 3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this 4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. 5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 6
7 import os 7 import os
8 import sys 8 import sys
9 import re 9 import re
10 import hashlib 10 import hashlib
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 if name.startswith('lib/') and re.search(r'\bXMLHttpRequest\b', content): 232 if name.startswith('lib/') and re.search(r'\bXMLHttpRequest\b', content):
233 templateData['hasXMLHttpRequest'] = True 233 templateData['hasXMLHttpRequest'] = True
234 if not '/' in name or name.startswith('lib/'): 234 if not '/' in name or name.startswith('lib/'):
235 if re.search(r'(?:^|\s)onShutdown\.', content): 235 if re.search(r'(?:^|\s)onShutdown\.', content):
236 templateData['hasShutdownHandlers'] = True 236 templateData['hasShutdownHandlers'] = True
237 237
238 for name, content in files.iteritems(): 238 for name, content in files.iteritems():
239 if name == 'chrome.manifest': 239 if name == 'chrome.manifest':
240 templateData['hasChrome'] = True 240 templateData['hasChrome'] = True
241 elif name == 'defaults/prefs.json': 241 elif name == 'defaults/prefs.json':
242 templateData['hasVersionPref'] = re.search(r'"currentVersion":', content) != None 242 templateData['hasVersionPref'] = 'currentVersion' in json.loads(content).g et('defaults', {})
Wladimir Palant 2015/05/29 18:40:52 It's JSON data now, we can do better: templateDat
Felix Dahlke 2015/05/29 20:04:10 Seemed a bit over the top to me considering that w
243 elif name.endswith('.js'): 243 elif name.endswith('.js'):
244 checkScript(name) 244 checkScript(name)
245 elif name.endswith('.xul'): 245 elif name.endswith('.xul'):
246 match = re.search(r'<(?:window|dialog)\s[^>]*\bwindowtype="([^">]+)"', con tent) 246 match = re.search(r'<(?:window|dialog)\s[^>]*\bwindowtype="([^">]+)"', con tent)
247 if match: 247 if match:
248 templateData['chromeWindows'].append(match.group(1)) 248 templateData['chromeWindows'].append(match.group(1))
249 249
250 while True: 250 while True:
251 missing = [] 251 missing = []
252 for module in templateData['requires']: 252 for module in templateData['requires']:
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 if metadata.has_section('preprocess'): 354 if metadata.has_section('preprocess'):
355 files.preprocess([f for f, _ in metadata.items('preprocess')]) 355 files.preprocess([f for f, _ in metadata.items('preprocess')])
356 if keyFile: 356 if keyFile:
357 signFiles(files, keyFile) 357 signFiles(files, keyFile)
358 files.zip(outFile, sortKey=lambda x: '!' if x == 'META-INF/zigbert.rsa' else x ) 358 files.zip(outFile, sortKey=lambda x: '!' if x == 'META-INF/zigbert.rsa' else x )
359 359
360 def autoInstall(baseDir, type, host, port, multicompartment=False): 360 def autoInstall(baseDir, type, host, port, multicompartment=False):
361 fileBuffer = StringIO() 361 fileBuffer = StringIO()
362 createBuild(baseDir, type=type, outFile=fileBuffer, multicompartment=multicomp artment) 362 createBuild(baseDir, type=type, outFile=fileBuffer, multicompartment=multicomp artment)
363 urllib.urlopen('http://%s:%s/' % (host, port), data=fileBuffer.getvalue()) 363 urllib.urlopen('http://%s:%s/' % (host, port), data=fileBuffer.getvalue())
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld