Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: packagerChrome.py

Issue 29575633: Issue 4720 - enable devenv target for Edge packager (Closed)
Patch Set: Addressing nit Created Oct. 18, 2017, 2:28 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build.py ('k') | packagerEdge.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 errno 5 import errno
6 import glob 6 import glob
7 import io 7 import io
8 import json 8 import json
9 import os 9 import os
10 import re 10 import re
11 from StringIO import StringIO 11 from StringIO import StringIO
12 import struct 12 import struct
13 import subprocess 13 import subprocess
14 import sys 14 import sys
15 import random
15 16
16 from packager import (readMetadata, getDefaultFileName, getBuildVersion, 17 from packager import (readMetadata, getDefaultFileName, getBuildVersion,
17 getTemplate, Files) 18 getTemplate, Files)
18 19
19 defaultLocale = 'en_US' 20 defaultLocale = 'en_US'
20 21
21 22
22 def getIgnoredFiles(params): 23 def getIgnoredFiles(params):
23 return {'store.description'} 24 return {'store.description'}
24 25
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 file = open(outputFile, 'wb') 313 file = open(outputFile, 'wb')
313 else: 314 else:
314 file = outputFile 315 file = outputFile
315 if pubkey != None and signature != None: 316 if pubkey != None and signature != None:
316 file.write(struct.pack('<4sIII', 'Cr24', 2, len(pubkey), len(signature)) ) 317 file.write(struct.pack('<4sIII', 'Cr24', 2, len(pubkey), len(signature)) )
317 file.write(pubkey) 318 file.write(pubkey)
318 file.write(signature) 319 file.write(signature)
319 file.write(zipdata) 320 file.write(zipdata)
320 321
321 322
323 def add_devenv_requirements(files, metadata, params):
324 files.read(
325 os.path.join(os.path.dirname(__file__), 'chromeDevenvPoller__.js'),
326 relpath='devenvPoller__.js',
327 )
328 files['devenvVersion__'] = str(random.random())
329
330 if metadata.has_option('general', 'testScripts'):
331 files['qunit/index.html'] = createScriptPage(
332 params, 'testIndex.html.tmpl', ('general', 'testScripts')
333 )
334
335
322 def createBuild(baseDir, type='chrome', outFile=None, buildNum=None, releaseBuil d=False, keyFile=None, devenv=False): 336 def createBuild(baseDir, type='chrome', outFile=None, buildNum=None, releaseBuil d=False, keyFile=None, devenv=False):
323 metadata = readMetadata(baseDir, type) 337 metadata = readMetadata(baseDir, type)
324 version = getBuildVersion(baseDir, metadata, releaseBuild, buildNum) 338 version = getBuildVersion(baseDir, metadata, releaseBuild, buildNum)
325 339
326 if outFile == None: 340 if outFile == None:
327 if type == 'gecko': 341 if type == 'gecko':
328 file_extension = 'xpi' 342 file_extension = 'xpi'
329 else: 343 else:
330 file_extension = 'crx' if keyFile else 'zip' 344 file_extension = 'crx' if keyFile else 'zip'
331 outFile = getDefaultFileName(metadata, version, file_extension) 345 outFile = getDefaultFileName(metadata, version, file_extension)
(...skipping 24 matching lines...) Expand all
356 ) 370 )
357 371
358 if metadata.has_section('import_locales'): 372 if metadata.has_section('import_locales'):
359 import_locales(params, files) 373 import_locales(params, files)
360 374
361 files['manifest.json'] = createManifest(params, files) 375 files['manifest.json'] = createManifest(params, files)
362 if type == 'chrome': 376 if type == 'chrome':
363 fix_translations_for_chrome(files) 377 fix_translations_for_chrome(files)
364 378
365 if devenv: 379 if devenv:
366 import buildtools 380 add_devenv_requirements(files, metadata, params)
367 import random
368 files.read(os.path.join(buildtools.__path__[0], 'chromeDevenvPoller__.js '), relpath='devenvPoller__.js')
369 files['devenvVersion__'] = str(random.random())
370
371 if metadata.has_option('general', 'testScripts'):
372 files['qunit/index.html'] = createScriptPage(
373 params, 'testIndex.html.tmpl', ('general', 'testScripts')
374 )
375 381
376 zipdata = files.zipToString() 382 zipdata = files.zipToString()
377 signature = None 383 signature = None
378 pubkey = None 384 pubkey = None
379 if keyFile != None: 385 if keyFile != None:
380 signature = signBinary(zipdata, keyFile) 386 signature = signBinary(zipdata, keyFile)
381 pubkey = getPublicKey(keyFile) 387 pubkey = getPublicKey(keyFile)
382 writePackage(outFile, pubkey, signature, zipdata) 388 writePackage(outFile, pubkey, signature, zipdata)
OLDNEW
« no previous file with comments | « build.py ('k') | packagerEdge.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld