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 Sebastian's comments Created Oct. 18, 2017, 9:24 a.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(os.path.join(os.path.dirname(__file__),
kzar 2017/10/18 13:50:26 Nit: IMO this would look nicer indented differentl
tlucas 2017/10/18 14:29:07 Done.
Sebastian Noack 2017/10/18 22:00:44 FWIW, both look good to me.
325 'chromeDevenvPoller__.js'),
326 relpath='devenvPoller__.js')
327 files['devenvVersion__'] = str(random.random())
328
329 if metadata.has_option('general', 'testScripts'):
330 files['qunit/index.html'] = createScriptPage(
331 params, 'testIndex.html.tmpl', ('general', 'testScripts')
332 )
333
334
322 def createBuild(baseDir, type='chrome', outFile=None, buildNum=None, releaseBuil d=False, keyFile=None, devenv=False): 335 def createBuild(baseDir, type='chrome', outFile=None, buildNum=None, releaseBuil d=False, keyFile=None, devenv=False):
323 metadata = readMetadata(baseDir, type) 336 metadata = readMetadata(baseDir, type)
324 version = getBuildVersion(baseDir, metadata, releaseBuild, buildNum) 337 version = getBuildVersion(baseDir, metadata, releaseBuild, buildNum)
325 338
326 if outFile == None: 339 if outFile == None:
327 if type == 'gecko': 340 if type == 'gecko':
328 file_extension = 'xpi' 341 file_extension = 'xpi'
329 else: 342 else:
330 file_extension = 'crx' if keyFile else 'zip' 343 file_extension = 'crx' if keyFile else 'zip'
331 outFile = getDefaultFileName(metadata, version, file_extension) 344 outFile = getDefaultFileName(metadata, version, file_extension)
(...skipping 24 matching lines...) Expand all
356 ) 369 )
357 370
358 if metadata.has_section('import_locales'): 371 if metadata.has_section('import_locales'):
359 import_locales(params, files) 372 import_locales(params, files)
360 373
361 files['manifest.json'] = createManifest(params, files) 374 files['manifest.json'] = createManifest(params, files)
362 if type == 'chrome': 375 if type == 'chrome':
363 fix_translations_for_chrome(files) 376 fix_translations_for_chrome(files)
364 377
365 if devenv: 378 if devenv:
366 import buildtools 379 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 380
376 zipdata = files.zipToString() 381 zipdata = files.zipToString()
377 signature = None 382 signature = None
378 pubkey = None 383 pubkey = None
379 if keyFile != None: 384 if keyFile != None:
380 signature = signBinary(zipdata, keyFile) 385 signature = signBinary(zipdata, keyFile)
381 pubkey = getPublicKey(keyFile) 386 pubkey = getPublicKey(keyFile)
382 writePackage(outFile, pubkey, signature, zipdata) 387 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