| Index: packagerChrome.py |
| diff --git a/packagerChrome.py b/packagerChrome.py |
| index d1b24968e935d5b6d86cdb7561419b701512453a..7fd76aa8a2134cfdebca5ad2ea805c77fe4310e3 100644 |
| --- a/packagerChrome.py |
| +++ b/packagerChrome.py |
| @@ -8,7 +8,6 @@ import io |
| import json |
| import os |
| import re |
| -from StringIO import StringIO |
| import struct |
| import subprocess |
| import sys |
| @@ -44,13 +43,15 @@ def processFile(path, data, params): |
| def makeIcons(files, filenames): |
| - try: |
| - from PIL import Image |
| - except ImportError: |
| - import Image |
| icons = {} |
| for filename in filenames: |
| - width, height = Image.open(StringIO(files[filename])).size |
| + try: |
| + magic, width, height = struct.unpack_from('>8s8xii', |
| + files[filename]) |
| + except struct.error: |
| + magic = None |
| + if magic != '\x89PNG\r\n\x1a\n': |
| + raise Exception(filename + ' is no valid PNG.') |
| if(width != height): |
| print >>sys.stderr, 'Warning: %s size is %ix%i, icon should be square' % (filename, width, height) |
| icons[width] = filename |
| @@ -197,7 +198,7 @@ def create_bundles(params, files): |
| bundles = json.loads(output) |
| for bundle in bundles: |
| - files[bundle] = bundles[bundle].encode('utf-8') |
| + files[bundle[1:]] = bundles[bundle].encode('utf-8') |
| def import_locales(params, files): |