| OLD | NEW |
| 1 # coding: utf-8 | 1 # coding: utf-8 |
| 2 | 2 |
| 3 # This Source Code Form is subject to the terms of the Mozilla Public | 3 # This Source Code Form is subject to the terms of the Mozilla Public |
| 4 # License, v. 2.0. If a copy of the MPL was not distributed with this | 4 # License, v. 2.0. If a copy of the MPL was not distributed with this |
| 5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. | 5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 6 | 6 |
| 7 import sys | 7 import sys |
| 8 import os | 8 import os |
| 9 import re | 9 import re |
| 10 import json | 10 import json |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 icon = makeIcons(files, icons) | 84 icon = makeIcons(files, icons) |
| 85 | 85 |
| 86 templateData[opt] = {'icon': icon, 'popup': popup} | 86 templateData[opt] = {'icon': icon, 'popup': popup} |
| 87 | 87 |
| 88 if metadata.has_option('general', 'icons'): | 88 if metadata.has_option('general', 'icons'): |
| 89 templateData['icons'] = makeIcons(files, | 89 templateData['icons'] = makeIcons(files, |
| 90 metadata.get('general', 'icons').split()) | 90 metadata.get('general', 'icons').split()) |
| 91 | 91 |
| 92 if metadata.has_option('general', 'permissions'): | 92 if metadata.has_option('general', 'permissions'): |
| 93 templateData['permissions'] = metadata.get('general', 'permissions').split() | 93 templateData['permissions'] = metadata.get('general', 'permissions').split() |
| 94 if params['experimentalAPI']: | |
| 95 templateData['permissions'].append('experimental') | |
| 96 | 94 |
| 97 if metadata.has_option('general', 'optionalPermissions'): | 95 if metadata.has_option('general', 'optionalPermissions'): |
| 98 templateData['optionalPermissions'] = metadata.get( | 96 templateData['optionalPermissions'] = metadata.get( |
| 99 'general', 'optionalPermissions').split() | 97 'general', 'optionalPermissions').split() |
| 100 | 98 |
| 101 if metadata.has_option('general', 'backgroundScripts'): | 99 if metadata.has_option('general', 'backgroundScripts'): |
| 102 templateData['backgroundScripts'] = metadata.get( | 100 templateData['backgroundScripts'] = metadata.get( |
| 103 'general', 'backgroundScripts').split() | 101 'general', 'backgroundScripts').split() |
| 104 if params['devenv']: | 102 if params['devenv']: |
| 105 templateData['backgroundScripts'].append('devenvPoller__.js') | 103 templateData['backgroundScripts'].append('devenvPoller__.js') |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 if isinstance(outputFile, basestring): | 300 if isinstance(outputFile, basestring): |
| 303 file = open(outputFile, 'wb') | 301 file = open(outputFile, 'wb') |
| 304 else: | 302 else: |
| 305 file = outputFile | 303 file = outputFile |
| 306 if pubkey != None and signature != None: | 304 if pubkey != None and signature != None: |
| 307 file.write(struct.pack('<4sIII', 'Cr24', 2, len(pubkey), len(signature))) | 305 file.write(struct.pack('<4sIII', 'Cr24', 2, len(pubkey), len(signature))) |
| 308 file.write(pubkey) | 306 file.write(pubkey) |
| 309 file.write(signature) | 307 file.write(signature) |
| 310 file.write(zipdata) | 308 file.write(zipdata) |
| 311 | 309 |
| 312 def createBuild(baseDir, type='chrome', outFile=None, buildNum=None, releaseBuil
d=False, keyFile=None, experimentalAPI=False, devenv=False): | 310 def createBuild(baseDir, type='chrome', outFile=None, buildNum=None, releaseBuil
d=False, keyFile=None, devenv=False): |
| 313 metadata = readMetadata(baseDir, type) | 311 metadata = readMetadata(baseDir, type) |
| 314 version = getBuildVersion(baseDir, metadata, releaseBuild, buildNum) | 312 version = getBuildVersion(baseDir, metadata, releaseBuild, buildNum) |
| 315 | 313 |
| 316 if outFile == None: | 314 if outFile == None: |
| 317 outFile = getDefaultFileName(metadata, version, 'crx' if keyFile else 'zip') | 315 outFile = getDefaultFileName(metadata, version, 'crx' if keyFile else 'zip') |
| 318 | 316 |
| 319 params = { | 317 params = { |
| 320 'type': type, | 318 'type': type, |
| 321 'baseDir': baseDir, | 319 'baseDir': baseDir, |
| 322 'releaseBuild': releaseBuild, | 320 'releaseBuild': releaseBuild, |
| 323 'version': version, | 321 'version': version, |
| 324 'experimentalAPI': experimentalAPI, | |
| 325 'devenv': devenv, | 322 'devenv': devenv, |
| 326 'metadata': metadata, | 323 'metadata': metadata, |
| 327 } | 324 } |
| 328 | 325 |
| 329 mapped = metadata.items('mapping') if metadata.has_section('mapping') else [] | 326 mapped = metadata.items('mapping') if metadata.has_section('mapping') else [] |
| 330 files = Files(getPackageFiles(params), getIgnoredFiles(params), | 327 files = Files(getPackageFiles(params), getIgnoredFiles(params), |
| 331 process=lambda path, data: processFile(path, data, params)) | 328 process=lambda path, data: processFile(path, data, params)) |
| 332 | 329 |
| 333 files.readMappedFiles(mapped) | 330 files.readMappedFiles(mapped) |
| 334 files.read(baseDir, skip=[opt for opt, _ in mapped]) | 331 files.read(baseDir, skip=[opt for opt, _ in mapped]) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 364 files['qunit/index.html'] = createScriptPage(params, 'testIndex.html.tmpl', | 361 files['qunit/index.html'] = createScriptPage(params, 'testIndex.html.tmpl', |
| 365 ('general', 'testScripts')) | 362 ('general', 'testScripts')) |
| 366 | 363 |
| 367 zipdata = files.zipToString() | 364 zipdata = files.zipToString() |
| 368 signature = None | 365 signature = None |
| 369 pubkey = None | 366 pubkey = None |
| 370 if keyFile != None: | 367 if keyFile != None: |
| 371 signature = signBinary(zipdata, keyFile) | 368 signature = signBinary(zipdata, keyFile) |
| 372 pubkey = getPublicKey(keyFile) | 369 pubkey = getPublicKey(keyFile) |
| 373 writePackage(outFile, pubkey, signature, zipdata) | 370 writePackage(outFile, pubkey, signature, zipdata) |
| OLD | NEW |