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

Side by Side Diff: packagerChrome.py

Issue 29501558: Issue 5383 - Add tests for the Chrome and Firefox packagers (Closed)
Patch Set: Completely purge PIL / Pillow, added edge-extension fixture / assert Created Sept. 11, 2017, 8:43 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 errno 5 import errno
6 import io 6 import io
7 import json 7 import json
8 import os 8 import os
9 import re 9 import re
10 from StringIO import StringIO 10 from StringIO import StringIO
(...skipping 25 matching lines...) Expand all
36 return result 36 return result
37 37
38 38
39 def processFile(path, data, params): 39 def processFile(path, data, params):
40 # We don't change anything yet, this function currently only exists here so 40 # We don't change anything yet, this function currently only exists here so
41 # that it can be overridden if necessary. 41 # that it can be overridden if necessary.
42 return data 42 return data
43 43
44 44
45 def makeIcons(files, filenames): 45 def makeIcons(files, filenames):
46 try:
47 from PIL import Image
48 except ImportError:
49 import Image
50 icons = {} 46 icons = {}
51 for filename in filenames: 47 for filename in filenames:
52 width, height = Image.open(StringIO(files[filename])).size 48 width, height = struct.unpack('>ii', files[filename][16:24])
53 if(width != height): 49 if(width != height):
54 print >>sys.stderr, 'Warning: %s size is %ix%i, icon should be squar e' % (filename, width, height) 50 print >>sys.stderr, 'Warning: %s size is %ix%i, icon should be squar e' % (filename, width, height)
55 icons[width] = filename 51 icons[width] = filename
56 return icons 52 return icons
57 53
58 54
59 def createScriptPage(params, template_name, script_option): 55 def createScriptPage(params, template_name, script_option):
60 template = getTemplate(template_name, autoEscape=True) 56 template = getTemplate(template_name, autoEscape=True)
61 return template.render( 57 return template.render(
62 basename=params['metadata'].get('general', 'basename'), 58 basename=params['metadata'].get('general', 'basename'),
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 params, 'testIndex.html.tmpl', ('general', 'testScripts') 412 params, 'testIndex.html.tmpl', ('general', 'testScripts')
417 ) 413 )
418 414
419 zipdata = files.zipToString() 415 zipdata = files.zipToString()
420 signature = None 416 signature = None
421 pubkey = None 417 pubkey = None
422 if keyFile != None: 418 if keyFile != None:
423 signature = signBinary(zipdata, keyFile) 419 signature = signBinary(zipdata, keyFile)
424 pubkey = getPublicKey(keyFile) 420 pubkey = getPublicKey(keyFile)
425 writePackage(outFile, pubkey, signature, zipdata) 421 writePackage(outFile, pubkey, signature, zipdata)
OLDNEW
« no previous file with comments | « .gitignore ('k') | tests/__init__.py » ('j') | tests/test_packagerEdge.py » ('J')

Powered by Google App Engine
This is Rietveld