| OLD | NEW | 
|---|
| 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 base64 | 5 import base64 | 
| 6 import ConfigParser | 6 import ConfigParser | 
| 7 import json | 7 import json | 
| 8 import os | 8 import os | 
| 9 import re | 9 import re | 
| 10 from urlparse import urlparse | 10 from urlparse import urlparse | 
| 11 | 11 | 
| 12 from packager import readMetadata, getDefaultFileName, getBuildVersion, getTempl
     ate, Files | 12 from packager import readMetadata, getDefaultFileName, getBuildVersion, getTempl
     ate, Files | 
| 13 from packagerChrome import convertJS, import_locales, getIgnoredFiles, getPackag
     eFiles, defaultLocale, createScriptPage | 13 from packagerChrome import create_bundles, import_locales, getIgnoredFiles, getP
     ackageFiles, defaultLocale, createScriptPage | 
| 14 | 14 | 
| 15 | 15 | 
| 16 def processFile(path, data, params): | 16 def processFile(path, data, params): | 
| 17     return data | 17     return data | 
| 18 | 18 | 
| 19 | 19 | 
| 20 def createManifest(params, files): | 20 def createManifest(params, files): | 
| 21     template = getTemplate('Info.plist.tmpl', autoEscape=True) | 21     template = getTemplate('Info.plist.tmpl', autoEscape=True) | 
| 22     metadata = params['metadata'] | 22     metadata = params['metadata'] | 
| 23     catalog = json.loads(files['_locales/%s/messages.json' % defaultLocale]) | 23     catalog = json.loads(files['_locales/%s/messages.json' % defaultLocale]) | 
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 137         'devenv': devenv, | 137         'devenv': devenv, | 
| 138         'metadata': metadata, | 138         'metadata': metadata, | 
| 139     } | 139     } | 
| 140 | 140 | 
| 141     mapped = metadata.items('mapping') if metadata.has_section('mapping') else [
     ] | 141     mapped = metadata.items('mapping') if metadata.has_section('mapping') else [
     ] | 
| 142     files = Files(getPackageFiles(params), getIgnoredFiles(params), | 142     files = Files(getPackageFiles(params), getIgnoredFiles(params), | 
| 143                   process=lambda path, data: processFile(path, data, params)) | 143                   process=lambda path, data: processFile(path, data, params)) | 
| 144     files.readMappedFiles(mapped) | 144     files.readMappedFiles(mapped) | 
| 145     files.read(baseDir, skip=[opt for opt, _ in mapped]) | 145     files.read(baseDir, skip=[opt for opt, _ in mapped]) | 
| 146 | 146 | 
| 147     if metadata.has_section('convert_js'): | 147     if metadata.has_section('bundles'): | 
| 148         convertJS(params, files) | 148         create_bundles(params, files) | 
| 149 | 149 | 
| 150     if metadata.has_section('preprocess'): | 150     if metadata.has_section('preprocess'): | 
| 151         files.preprocess( | 151         files.preprocess( | 
| 152             [f for f, _ in metadata.items('preprocess')], | 152             [f for f, _ in metadata.items('preprocess')], | 
| 153             {'needsExt': True} | 153             {'needsExt': True} | 
| 154         ) | 154         ) | 
| 155 | 155 | 
| 156     if metadata.has_section('import_locales'): | 156     if metadata.has_section('import_locales'): | 
| 157         import_locales(params, files) | 157         import_locales(params, files) | 
| 158 | 158 | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
| 172 | 172 | 
| 173     dirname = metadata.get('general', 'basename') + '.safariextension' | 173     dirname = metadata.get('general', 'basename') + '.safariextension' | 
| 174     for filename in files.keys(): | 174     for filename in files.keys(): | 
| 175         files[os.path.join(dirname, filename)] = files.pop(filename) | 175         files[os.path.join(dirname, filename)] = files.pop(filename) | 
| 176 | 176 | 
| 177     if not devenv and keyFile: | 177     if not devenv and keyFile: | 
| 178         from buildtools import xarfile | 178         from buildtools import xarfile | 
| 179         xarfile.create(outFile, files, keyFile) | 179         xarfile.create(outFile, files, keyFile) | 
| 180     else: | 180     else: | 
| 181         files.zip(outFile) | 181         files.zip(outFile) | 
| OLD | NEW | 
|---|