| OLD | NEW |
| 1 # coding: utf-8 | 1 # coding: utf-8 |
| 2 | 2 |
| 3 # This file is part of the Adblock Plus build tools, | 3 # This file is part of the Adblock Plus build tools, |
| 4 # Copyright (C) 2006-2014 Eyeo GmbH | 4 # Copyright (C) 2006-2014 Eyeo GmbH |
| 5 # | 5 # |
| 6 # Adblock Plus is free software: you can redistribute it and/or modify | 6 # Adblock Plus is free software: you can redistribute it and/or modify |
| 7 # it under the terms of the GNU General Public License version 3 as | 7 # it under the terms of the GNU General Public License version 3 as |
| 8 # published by the Free Software Foundation. | 8 # published by the Free Software Foundation. |
| 9 # | 9 # |
| 10 # Adblock Plus is distributed in the hope that it will be useful, | 10 # Adblock Plus is distributed in the hope that it will be useful, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 if file.endswith('.js') or file.endswith('.html') or file.endswith('.xml'): | 44 if file.endswith('.js') or file.endswith('.html') or file.endswith('.xml'): |
| 45 result.add(file) | 45 result.add(file) |
| 46 return result | 46 return result |
| 47 | 47 |
| 48 def processFile(path, data, params): | 48 def processFile(path, data, params): |
| 49 # We don't change anything yet, this function currently only exists here so | 49 # We don't change anything yet, this function currently only exists here so |
| 50 # that it can be overridden if necessary. | 50 # that it can be overridden if necessary. |
| 51 return data | 51 return data |
| 52 | 52 |
| 53 def makeIcons(files, filenames): | 53 def makeIcons(files, filenames): |
| 54 from PIL import Image | 54 try: |
| 55 from PIL import Image |
| 56 except ImportError: |
| 57 import Image |
| 55 icons = {} | 58 icons = {} |
| 56 for filename in filenames: | 59 for filename in filenames: |
| 57 width, height = Image.open(StringIO(files[filename])).size | 60 width, height = Image.open(StringIO(files[filename])).size |
| 58 if(width != height): | 61 if(width != height): |
| 59 print >>sys.stderr, 'Warning: %s size is %ix%i, icon should be square' % (
filename, width, height) | 62 print >>sys.stderr, 'Warning: %s size is %ix%i, icon should be square' % (
filename, width, height) |
| 60 icons[width] = filename | 63 icons[width] = filename |
| 61 return icons | 64 return icons |
| 62 | 65 |
| 63 def createManifest(params, files): | 66 def createManifest(params, files): |
| 64 template = getTemplate('manifest.json.tmpl') | 67 template = getTemplate('manifest.json.tmpl') |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 writePackage(outFile, pubkey, signature, zipdata) | 393 writePackage(outFile, pubkey, signature, zipdata) |
| 391 | 394 |
| 392 def createDevEnv(baseDir, type): | 395 def createDevEnv(baseDir, type): |
| 393 fileBuffer = StringIO() | 396 fileBuffer = StringIO() |
| 394 createBuild(baseDir, type=type, outFile=fileBuffer, devenv=True, releaseBuild=
True) | 397 createBuild(baseDir, type=type, outFile=fileBuffer, devenv=True, releaseBuild=
True) |
| 395 | 398 |
| 396 from zipfile import ZipFile | 399 from zipfile import ZipFile |
| 397 zip = ZipFile(StringIO(fileBuffer.getvalue()), 'r') | 400 zip = ZipFile(StringIO(fileBuffer.getvalue()), 'r') |
| 398 zip.extractall(os.path.join(baseDir, 'devenv')) | 401 zip.extractall(os.path.join(baseDir, 'devenv')) |
| 399 zip.close() | 402 zip.close() |
| OLD | NEW |