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 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 digestinfo, | 196 digestinfo, |
197 M2Crypto.RSA.pkcs1_padding | 197 M2Crypto.RSA.pkcs1_padding |
198 )) | 198 )) |
199 finally: | 199 finally: |
200 os.close(fd) | 200 os.close(fd) |
201 | 201 |
202 subprocess.check_call(['xar', '--inject-sig', signature_filename, '-f', outF
ile]) | 202 subprocess.check_call(['xar', '--inject-sig', signature_filename, '-f', outF
ile]) |
203 finally: | 203 finally: |
204 os.unlink(signature_filename) | 204 os.unlink(signature_filename) |
205 | 205 |
206 def createBuild(baseDir, type, outFile=None, buildNum=None, releaseBuild=False,
keyFile=None): | 206 def createBuild(baseDir, type, outFile=None, buildNum=None, releaseBuild=False,
keyFile=None, devenv=False): |
207 metadata = readMetadata(baseDir, type) | 207 metadata = readMetadata(baseDir, type) |
208 version = getBuildVersion(baseDir, metadata, releaseBuild, buildNum) | 208 version = getBuildVersion(baseDir, metadata, releaseBuild, buildNum) |
209 | 209 |
210 if not outFile: | 210 if not outFile: |
211 outFile = getDefaultFileName(baseDir, metadata, version, 'safariextz' if key
File else 'zip') | 211 outFile = getDefaultFileName(baseDir, metadata, version, 'safariextz' if key
File else 'zip') |
212 | 212 |
213 params = { | 213 params = { |
214 'type': type, | 214 'type': type, |
215 'baseDir': baseDir, | 215 'baseDir': baseDir, |
216 'releaseBuild': releaseBuild, | 216 'releaseBuild': releaseBuild, |
217 'version': version, | 217 'version': version, |
218 'devenv': False, | 218 'devenv': devenv, |
219 'metadata': metadata, | 219 'metadata': metadata, |
220 } | 220 } |
221 | 221 |
222 files = Files(getPackageFiles(params), getIgnoredFiles(params), | 222 files = Files(getPackageFiles(params), getIgnoredFiles(params), |
223 process=lambda path, data: processFile(path, data, params)) | 223 process=lambda path, data: processFile(path, data, params)) |
224 if metadata.has_section('mapping'): | 224 if metadata.has_section('mapping'): |
225 files.readMappedFiles(metadata.items('mapping')) | 225 files.readMappedFiles(metadata.items('mapping')) |
226 files.read(baseDir) | 226 files.read(baseDir) |
227 | 227 |
228 if metadata.has_section('convert_js'): | 228 if metadata.has_section('convert_js'): |
(...skipping 11 matching lines...) Expand all Loading... |
240 | 240 |
241 if metadata.has_section('import_locales'): | 241 if metadata.has_section('import_locales'): |
242 importGeckoLocales(params, files) | 242 importGeckoLocales(params, files) |
243 | 243 |
244 files['lib/info.js'] = createInfoModule(params) | 244 files['lib/info.js'] = createInfoModule(params) |
245 files['background.html'] = createBackgroundPage(params) | 245 files['background.html'] = createBackgroundPage(params) |
246 files['Info.plist'] = createManifest(params, files) | 246 files['Info.plist'] = createManifest(params, files) |
247 | 247 |
248 fixAbsoluteUrls(files) | 248 fixAbsoluteUrls(files) |
249 | 249 |
250 dirname = metadata.get('general', 'basename') + '.safariextension' | 250 if not devenv: |
251 for filename in files.keys(): | 251 dirname = metadata.get('general', 'basename') + '.safariextension' |
252 files[os.path.join(dirname, filename)] = files.pop(filename) | 252 for filename in files.keys(): |
| 253 files[os.path.join(dirname, filename)] = files.pop(filename) |
253 | 254 |
254 if keyFile: | 255 if keyFile: |
255 createSignedXarArchive(outFile, files, keyFile) | 256 createSignedXarArchive(outFile, files, keyFile) |
256 else: | 257 return |
257 files.zip(outFile) | 258 |
| 259 files.zip(outFile) |
OLD | NEW |