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, importGeckoLocales, getIgnoredFiles, getPa
ckageFiles, defaultLocale, createScriptPage | 13 from packagerChrome import convertJS, import_locales, getIgnoredFiles, getPackag
eFiles, 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 if metadata.has_section('convert_js'): | 147 if metadata.has_section('convert_js'): |
148 convertJS(params, files) | 148 convertJS(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 importGeckoLocales(params, files) | 157 import_locales(params, files) |
158 | 158 |
159 if metadata.has_option('general', 'testScripts'): | 159 if metadata.has_option('general', 'testScripts'): |
160 files['qunit/index.html'] = createScriptPage(params, 'testIndex.html.tmp
l', | 160 files['qunit/index.html'] = createScriptPage(params, 'testIndex.html.tmp
l', |
161 ('general', 'testScripts')) | 161 ('general', 'testScripts')) |
162 | 162 |
163 if keyFile: | 163 if keyFile: |
164 from buildtools import xarfile | 164 from buildtools import xarfile |
165 certs, key = xarfile.read_certificates_and_key(keyFile) | 165 certs, key = xarfile.read_certificates_and_key(keyFile) |
166 params['developerIdentifier'] = get_developer_identifier(certs) | 166 params['developerIdentifier'] = get_developer_identifier(certs) |
167 | 167 |
168 files['lib/info.js'] = createInfoModule(params) | 168 files['lib/info.js'] = createInfoModule(params) |
169 files['background.html'] = createScriptPage(params, 'background.html.tmpl', | 169 files['background.html'] = createScriptPage(params, 'background.html.tmpl', |
170 ('general', 'backgroundScripts')
) | 170 ('general', 'backgroundScripts')
) |
171 files['Info.plist'] = createManifest(params, files) | 171 files['Info.plist'] = createManifest(params, files) |
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 |