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

Side by Side Diff: packagerGecko.py

Issue 29361133: Issue 4544 - Consider platformHTMLBindings.xml when detecting available keyboard shortcuts (Closed) Base URL: https://hg.adblockplus.org/buildtools
Patch Set: Created Oct. 31, 2016, 10:02 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 # This Source Code Form is subject to the terms of the Mozilla Public 1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this 2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4 4
5 import os 5 import os
6 import sys 6 import sys
7 import re 7 import re
8 import hashlib 8 import hashlib
9 import base64 9 import base64
10 import urllib 10 import urllib
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 params['jsonRequires'][name[len(prefix):]] = json.loads(content) 230 params['jsonRequires'][name[len(prefix):]] = json.loads(content)
231 for name in params['jsonRequires'].iterkeys(): 231 for name in params['jsonRequires'].iterkeys():
232 del files[prefix + name] 232 del files[prefix + name]
233 233
234 234
235 def addMissingFiles(params, files): 235 def addMissingFiles(params, files):
236 templateData = { 236 templateData = {
237 'hasChrome': False, 237 'hasChrome': False,
238 'hasChromeRequires': False, 238 'hasChromeRequires': False,
239 'hasShutdownHandlers': False, 239 'hasShutdownHandlers': False,
240 'hasXMLHttpRequest': False,
241 'chromeWindows': [], 240 'chromeWindows': [],
242 'requires': set(), 241 'requires': set(),
243 'jsonRequires': params['jsonRequires'], 242 'jsonRequires': params['jsonRequires'],
244 'metadata': params['metadata'], 243 'metadata': params['metadata'],
245 'multicompartment': params['multicompartment'], 244 'multicompartment': params['multicompartment'],
246 'applications': dict((v, k) for k, v in KNOWN_APPS.iteritems()), 245 'applications': dict((v, k) for k, v in KNOWN_APPS.iteritems()),
247 } 246 }
248 247
249 def checkScript(name): 248 def checkScript(name):
250 content = files[name] 249 content = files[name]
251 for match in re.finditer(r'(?:^|\s)require\(\s*"([\w\-]+)"\s*\)', conten t): 250 for match in re.finditer(r'(?:^|\s)require\(\s*"([\w\-]+)"\s*\)', conten t):
252 templateData['requires'].add(match.group(1)) 251 templateData['requires'].add(match.group(1))
253 if name.startswith('chrome/content/'): 252 if name.startswith('chrome/content/'):
254 templateData['hasChromeRequires'] = True 253 templateData['hasChromeRequires'] = True
255 if name.startswith('lib/') and re.search(r'\bXMLHttpRequest\b', content) :
256 templateData['hasXMLHttpRequest'] = True
257 if not '/' in name or name.startswith('lib/'): 254 if not '/' in name or name.startswith('lib/'):
258 if re.search(r'(?:^|\s)onShutdown\.', content): 255 if re.search(r'(?:^|\s)onShutdown\.', content):
259 templateData['hasShutdownHandlers'] = True 256 templateData['hasShutdownHandlers'] = True
260 257
261 for name, content in files.iteritems(): 258 for name, content in files.iteritems():
262 if name == 'chrome.manifest': 259 if name == 'chrome.manifest':
263 templateData['hasChrome'] = True 260 templateData['hasChrome'] = True
264 elif name.endswith('.js'): 261 elif name.endswith('.js'):
265 checkScript(name) 262 checkScript(name)
266 elif name.endswith('.xul'): 263 elif name.endswith('.xul'):
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 addMissingFiles(params, files) 326 addMissingFiles(params, files)
330 if metadata.has_section('preprocess'): 327 if metadata.has_section('preprocess'):
331 files.preprocess([f for f, _ in metadata.items('preprocess')]) 328 files.preprocess([f for f, _ in metadata.items('preprocess')])
332 files.zip(outFile, sortKey=lambda x: '!' if x == 'META-INF/zigbert.rsa' else x) 329 files.zip(outFile, sortKey=lambda x: '!' if x == 'META-INF/zigbert.rsa' else x)
333 330
334 331
335 def autoInstall(baseDir, type, host, port, multicompartment=False): 332 def autoInstall(baseDir, type, host, port, multicompartment=False):
336 fileBuffer = StringIO() 333 fileBuffer = StringIO()
337 createBuild(baseDir, type=type, outFile=fileBuffer, multicompartment=multico mpartment) 334 createBuild(baseDir, type=type, outFile=fileBuffer, multicompartment=multico mpartment)
338 urllib.urlopen('http://%s:%s/' % (host, port), data=fileBuffer.getvalue()) 335 urllib.urlopen('http://%s:%s/' % (host, port), data=fileBuffer.getvalue())
OLDNEW
« no previous file with comments | « lib/keySelector.js ('k') | templates/bootstrap.js.tmpl » ('j') | templates/bootstrap.js.tmpl » ('J')

Powered by Google App Engine
This is Rietveld