| 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 os | 7 import os |
| 8 import re | 8 import re |
| 9 import json | 9 import json |
| 10 import ConfigParser | 10 import ConfigParser |
| 11 from urlparse import urlparse | 11 from urlparse import urlparse |
| 12 | 12 |
| 13 from packager import readMetadata, getDefaultFileName, getBuildVersion, getTempl
ate, Files | 13 from packager import readMetadata, getDefaultFileName, getBuildVersion, getTempl
ate, Files |
| 14 from packagerChrome import convertJS, importGeckoLocales, getIgnoredFiles, getPa
ckageFiles, defaultLocale | 14 from packagerChrome import convertJS, importGeckoLocales, getIgnoredFiles, getPa
ckageFiles, defaultLocale, createScriptPage |
| 15 | 15 |
| 16 def processFile(path, data, params): | 16 def processFile(path, data, params): |
| 17 return data | 17 return data |
| 18 | 18 |
| 19 def createManifest(params, files): | 19 def createManifest(params, files): |
| 20 template = getTemplate('Info.plist.tmpl', autoEscape=True) | 20 template = getTemplate('Info.plist.tmpl', autoEscape=True) |
| 21 metadata = params['metadata'] | 21 metadata = params['metadata'] |
| 22 catalog = json.loads(files['_locales/%s/messages.json' % defaultLocale]) | 22 catalog = json.loads(files['_locales/%s/messages.json' % defaultLocale]) |
| 23 | 23 |
| 24 def parse_section(section, depth=1): | 24 def parse_section(section, depth=1): |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 ) | 256 ) |
| 257 | 257 |
| 258 if metadata.has_section('import_locales'): | 258 if metadata.has_section('import_locales'): |
| 259 importGeckoLocales(params, files) | 259 importGeckoLocales(params, files) |
| 260 | 260 |
| 261 if keyFile: | 261 if keyFile: |
| 262 certs, key = get_certificates_and_key(keyFile) | 262 certs, key = get_certificates_and_key(keyFile) |
| 263 params['developerIdentifier'] = get_developer_identifier(certs) | 263 params['developerIdentifier'] = get_developer_identifier(certs) |
| 264 | 264 |
| 265 files['lib/info.js'] = createInfoModule(params) | 265 files['lib/info.js'] = createInfoModule(params) |
| 266 files['background.html'] = createBackgroundPage(params) | 266 files['background.html'] = createScriptPage(params, 'background.html.tmpl', |
| 267 ('general', 'backgroundScripts')) |
| 267 files['Info.plist'] = createManifest(params, files) | 268 files['Info.plist'] = createManifest(params, files) |
| 268 | 269 |
| 269 fixAbsoluteUrls(files) | 270 fixAbsoluteUrls(files) |
| 270 | 271 |
| 271 dirname = metadata.get('general', 'basename') + '.safariextension' | 272 dirname = metadata.get('general', 'basename') + '.safariextension' |
| 272 for filename in files.keys(): | 273 for filename in files.keys(): |
| 273 files[os.path.join(dirname, filename)] = files.pop(filename) | 274 files[os.path.join(dirname, filename)] = files.pop(filename) |
| 274 | 275 |
| 275 if not devenv and keyFile: | 276 if not devenv and keyFile: |
| 276 createSignedXarArchive(outFile, files, certs, key) | 277 createSignedXarArchive(outFile, files, certs, key) |
| 277 else: | 278 else: |
| 278 files.zip(outFile) | 279 files.zip(outFile) |
| OLD | NEW |