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

Side by Side Diff: packagerChrome.py

Issue 30061555: Noissue - Added info.locale (Closed)
Patch Set: Created Oct. 4, 2019, 11:54 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 | « no previous file | templates/chromeInfo.js.tmpl » ('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 ConfigParser 5 import ConfigParser
6 import errno 6 import errno
7 import glob 7 import glob
8 import io 8 import io
9 import json 9 import json
10 import os 10 import os
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 144
145 def toJson(data): 145 def toJson(data):
146 return json.dumps( 146 return json.dumps(
147 data, ensure_ascii=False, sort_keys=True, 147 data, ensure_ascii=False, sort_keys=True,
148 indent=2, separators=(',', ': '), 148 indent=2, separators=(',', ': '),
149 ).encode('utf-8') + '\n' 149 ).encode('utf-8') + '\n'
150 150
151 151
152 def create_bundles(params, files, bundle_tests): 152 def create_bundles(params, files, bundle_tests):
153 base_extension_path = params['baseDir'] 153 base_extension_path = params['baseDir']
154 info_templates = {
155 'chrome': 'chromeInfo.js.tmpl',
156 'edge': 'edgeInfo.js.tmpl',
157 'gecko': 'geckoInfo.js.tmpl',
158 }
159 aliases = { 154 aliases = {
160 # To use our custom loader for the info module we must first set up an 155 # To use our custom loader for the info module we must first set up an
161 # alias to a file that exists. 156 # alias to a file that exists.
162 'info$': os.path.join(os.path.dirname(__file__), 'info.js'), 157 'info$': os.path.join(os.path.dirname(__file__), 'info.js'),
163 # Prevent builtin Node.js modules from being used instead of our own 158 # Prevent builtin Node.js modules from being used instead of our own
164 # when the names clash. Once relative paths are used this won't be 159 # when the names clash. Once relative paths are used this won't be
165 # necessary. 160 # necessary.
166 'url$': 'url.js', 161 'url$': 'url.js',
167 'events$': 'events.js', 162 'events$': 'events.js',
168 'punycode$': 'punycode.js', 163 'punycode$': 'punycode.js',
169 } 164 }
170 try: 165 try:
171 aliases.update(params['metadata'].items('module_alias')) 166 aliases.update(params['metadata'].items('module_alias'))
172 except ConfigParser.NoSectionError: 167 except ConfigParser.NoSectionError:
173 pass 168 pass
174 169
175 # Historically we didn't use relative paths when requiring modules, so in 170 # Historically we didn't use relative paths when requiring modules, so in
176 # order for webpack to know where to find them we need to pass in a list of 171 # order for webpack to know where to find them we need to pass in a list of
177 # resolve paths. Going forward we should always use relative paths, once we 172 # resolve paths. Going forward we should always use relative paths, once we
178 # do that consistently this can be removed. See issues 5760, 5761 and 5762. 173 # do that consistently this can be removed. See issues 5760, 5761 and 5762.
179 resolve_paths = [os.path.join(base_extension_path, dir, 'lib') 174 resolve_paths = [os.path.join(base_extension_path, dir, 'lib')
180 for dir in ['', 'adblockpluscore', 'adblockplusui']] 175 for dir in ['', 'adblockpluscore', 'adblockplusui']]
181 176
182 info_template = getTemplate(info_templates[params['type']]) 177 info_template = getTemplate('info.js.tmpl')
183 info_module = info_template.render( 178 info_module = info_template.render(
184 basename=params['metadata'].get('general', 'basename'), 179 basename=params['metadata'].get('general', 'basename'),
185 version=params['version'], 180 version=params['version'],
181 type=params['type'],
186 ).encode('utf-8') 182 ).encode('utf-8')
187 183
188 configuration = { 184 configuration = {
189 'bundles': [], 185 'bundles': [],
190 'extension_path': base_extension_path, 186 'extension_path': base_extension_path,
191 'info_module': info_module, 187 'info_module': info_module,
192 'resolve_paths': resolve_paths, 188 'resolve_paths': resolve_paths,
193 'aliases': aliases, 189 'aliases': aliases,
194 } 190 }
195 191
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 if devenv: 394 if devenv:
399 add_devenv_requirements(files, metadata, params) 395 add_devenv_requirements(files, metadata, params)
400 396
401 zipdata = files.zipToString() 397 zipdata = files.zipToString()
402 signature = None 398 signature = None
403 pubkey = None 399 pubkey = None
404 if keyFile != None: 400 if keyFile != None:
405 signature = signBinary(zipdata, keyFile) 401 signature = signBinary(zipdata, keyFile)
406 pubkey = getPublicKey(keyFile) 402 pubkey = getPublicKey(keyFile)
407 writePackage(outFile, pubkey, signature, zipdata) 403 writePackage(outFile, pubkey, signature, zipdata)
OLDNEW
« no previous file with comments | « no previous file | templates/chromeInfo.js.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld