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

Delta Between Two Patch Sets: packagerChrome.py

Issue 29743581: Issue 6552 - Support arbitrary manifest values (Closed) Base URL: https://hg.adblockplus.org/buildtools/file/a3db4a1a49e8
Left Patch Set: Issue 6552 - Support arbitrary manifest values Created April 11, 2018, 9:42 a.m.
Right Patch Set: Created April 19, 2018, 11:42 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
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
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 # ... = icon-19.png icon-38.png popup.html 94 # ... = icon-19.png icon-38.png popup.html
95 popup = icons.pop() 95 popup = icons.pop()
96 icon = makeIcons(files, icons) 96 icon = makeIcons(files, icons)
97 else: 97 else:
98 # ... = icon-16.png icon-32.png icon-48.png 98 # ... = icon-16.png icon-32.png icon-48.png
99 icon = makeIcons(files, icons) 99 icon = makeIcons(files, icons)
100 popup = None 100 popup = None
101 101
102 templateData[opt] = {'icon': icon, 'popup': popup} 102 templateData[opt] = {'icon': icon, 'popup': popup}
103 103
104 # Generate templatedataa which does not need special processing
105 arbitrary_manifest = metadata.as_json_object('manifest')
106 templateData.update(arbitrary_manifest)
107
108 if metadata.has_option('general', 'icons'): 104 if metadata.has_option('general', 'icons'):
109 templateData['icons'] = makeIcons(files, 105 templateData['icons'] = makeIcons(files,
110 metadata.get('general', 'icons').split ()) 106 metadata.get('general', 'icons').split ())
111 107
112 if metadata.has_option('general', 'backgroundScripts'): 108 if metadata.has_option('general', 'backgroundScripts'):
113 templateData['backgroundScripts'] = metadata.get( 109 templateData['backgroundScripts'] = metadata.get(
114 'general', 'backgroundScripts').split() 110 'general', 'backgroundScripts').split()
115 if params['devenv']: 111 if params['devenv']:
116 templateData['backgroundScripts'].append('devenvPoller__.js') 112 templateData['backgroundScripts'].append('devenvPoller__.js')
117 113
(...skipping 13 matching lines...) Expand all
131 if params['type'] == 'gecko': 127 if params['type'] == 'gecko':
132 templateData['app_id'] = get_app_id(params['releaseBuild'], metadata) 128 templateData['app_id'] = get_app_id(params['releaseBuild'], metadata)
133 129
134 manifest = template.render(templateData) 130 manifest = template.render(templateData)
135 131
136 # Normalize JSON structure 132 # Normalize JSON structure
137 licenseComment = re.compile(r'/\*.*?\*/', re.S) 133 licenseComment = re.compile(r'/\*.*?\*/', re.S)
138 data = json.loads(re.sub(licenseComment, '', manifest, 1)) 134 data = json.loads(re.sub(licenseComment, '', manifest, 1))
139 if '_dummy' in data: 135 if '_dummy' in data:
140 del data['_dummy'] 136 del data['_dummy']
137
138 metadata.serialize_section_if_present('manifest', data)
141 manifest = json.dumps(data, sort_keys=True, indent=2) 139 manifest = json.dumps(data, sort_keys=True, indent=2)
142 140
143 return manifest.encode('utf-8') 141 return manifest.encode('utf-8')
144 142
145 143
146 def toJson(data): 144 def toJson(data):
147 return json.dumps( 145 return json.dumps(
148 data, ensure_ascii=False, sort_keys=True, 146 data, ensure_ascii=False, sort_keys=True,
149 indent=2, separators=(',', ': ') 147 indent=2, separators=(',', ': ')
150 ).encode('utf-8') + '\n' 148 ).encode('utf-8') + '\n'
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 if devenv: 387 if devenv:
390 add_devenv_requirements(files, metadata, params) 388 add_devenv_requirements(files, metadata, params)
391 389
392 zipdata = files.zipToString() 390 zipdata = files.zipToString()
393 signature = None 391 signature = None
394 pubkey = None 392 pubkey = None
395 if keyFile != None: 393 if keyFile != None:
396 signature = signBinary(zipdata, keyFile) 394 signature = signBinary(zipdata, keyFile)
397 pubkey = getPublicKey(keyFile) 395 pubkey = getPublicKey(keyFile)
398 writePackage(outFile, pubkey, signature, zipdata) 396 writePackage(outFile, pubkey, signature, zipdata)
LEFTRIGHT

Powered by Google App Engine
This is Rietveld