| 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-2013 Eyeo GmbH | 4 # Copyright (C) 2006-2013 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 if '_dummy' in data: | 121 if '_dummy' in data: |
| 122 del data['_dummy'] | 122 del data['_dummy'] |
| 123 manifest = json.dumps(data, sort_keys=True, indent=2) | 123 manifest = json.dumps(data, sort_keys=True, indent=2) |
| 124 | 124 |
| 125 return manifest.encode('utf-8') | 125 return manifest.encode('utf-8') |
| 126 | 126 |
| 127 def createPoller(params): | 127 def createPoller(params): |
| 128 template = getTemplate('chromeDevenvPoller__.js.tmpl') | 128 template = getTemplate('chromeDevenvPoller__.js.tmpl') |
| 129 return template.render(params).encode('utf-8'); | 129 return template.render(params).encode('utf-8'); |
| 130 | 130 |
| 131 def createInfoModule(params): |
| 132 template = getTemplate('chromeInfo.js.tmpl') |
| 133 return template.render(params).encode('utf-8'); |
| 134 |
| 131 def convertJS(params, files): | 135 def convertJS(params, files): |
| 132 from jshydra.abp_rewrite import doRewrite | 136 from jshydra.abp_rewrite import doRewrite |
| 133 | 137 |
| 134 for item in params['metadata'].items('convert_js'): | 138 for item in params['metadata'].items('convert_js'): |
| 135 file, sources = item | 139 file, sources = item |
| 136 baseDir = os.path.dirname(item.source) | 140 baseDir = os.path.dirname(item.source) |
| 137 | 141 |
| 138 # Make sure the file is inside an included directory | 142 # Make sure the file is inside an included directory |
| 139 if '/' in file and not files.isIncluded(file): | 143 if '/' in file and not files.isIncluded(file): |
| 140 continue | 144 continue |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 | 334 |
| 331 if metadata.has_section('convert_js'): | 335 if metadata.has_section('convert_js'): |
| 332 convertJS(params, files) | 336 convertJS(params, files) |
| 333 | 337 |
| 334 if metadata.has_section('import_locales'): | 338 if metadata.has_section('import_locales'): |
| 335 importGeckoLocales(params, files) | 339 importGeckoLocales(params, files) |
| 336 | 340 |
| 337 if devenv: | 341 if devenv: |
| 338 files['devenvPoller__.js'] = createPoller(params) | 342 files['devenvPoller__.js'] = createPoller(params) |
| 339 | 343 |
| 344 if (metadata.has_option('general', 'backgroundScripts') and |
| 345 'lib/info.js' in re.split(r'\s+', metadata.get('general', 'backgroundScrip
ts')) and |
| 346 'lib/info.js' not in files): |
| 347 files['lib/info.js'] = createInfoModule(params) |
| 348 |
| 340 zipdata = files.zipToString() | 349 zipdata = files.zipToString() |
| 341 signature = None | 350 signature = None |
| 342 pubkey = None | 351 pubkey = None |
| 343 if keyFile != None: | 352 if keyFile != None: |
| 344 signature = signBinary(zipdata, keyFile) | 353 signature = signBinary(zipdata, keyFile) |
| 345 pubkey = getPublicKey(keyFile) | 354 pubkey = getPublicKey(keyFile) |
| 346 writePackage(outFile, pubkey, signature, zipdata) | 355 writePackage(outFile, pubkey, signature, zipdata) |
| 347 | 356 |
| 348 def createDevEnv(baseDir, type): | 357 def createDevEnv(baseDir, type): |
| 349 fileBuffer = StringIO() | 358 fileBuffer = StringIO() |
| (...skipping 20 matching lines...) Expand all Loading... |
| 370 def shutdown_server(server): | 379 def shutdown_server(server): |
| 371 time.sleep(10) | 380 time.sleep(10) |
| 372 server.shutdown() | 381 server.shutdown() |
| 373 thread.start_new_thread(shutdown_server, (server,)) | 382 thread.start_new_thread(shutdown_server, (server,)) |
| 374 server.serve_forever() | 383 server.serve_forever() |
| 375 | 384 |
| 376 if connections[0] == 0: | 385 if connections[0] == 0: |
| 377 print 'Warning: No incoming connections, extension probably not active in th
e browser yet' | 386 print 'Warning: No incoming connections, extension probably not active in th
e browser yet' |
| 378 else: | 387 else: |
| 379 print 'Handled %i connection(s)' % connections[0] | 388 print 'Handled %i connection(s)' % connections[0] |
| OLD | NEW |