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

Side by Side Diff: packagerChrome.py

Issue 29743581: Issue 6552 - Support arbitrary manifest values (Closed) Base URL: https://hg.adblockplus.org/buildtools/file/a3db4a1a49e8
Patch Set: Created April 5, 2018, 10:21 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 | « no previous file | templates/manifest.json.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 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 import struct 11 import struct
12 import subprocess 12 import subprocess
13 import sys 13 import sys
14 import random 14 import random
15 import posixpath 15 import posixpath
16 import ConfigParser
16 17
17 from packager import (readMetadata, getDefaultFileName, getBuildVersion, 18 from packager import (readMetadata, getDefaultFileName, getBuildVersion,
18 getTemplate, get_extension, Files, get_app_id) 19 getTemplate, get_extension, Files, get_app_id)
19 20
20 defaultLocale = 'en_US' 21 defaultLocale = 'en_US'
21 22
22 23
23 def getIgnoredFiles(params): 24 def getIgnoredFiles(params):
24 return {'store.description'} 25 return {'store.description'}
25 26
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 if metadata.has_option('general', 'backgroundScripts'): 116 if metadata.has_option('general', 'backgroundScripts'):
116 templateData['backgroundScripts'] = metadata.get( 117 templateData['backgroundScripts'] = metadata.get(
117 'general', 'backgroundScripts').split() 118 'general', 'backgroundScripts').split()
118 if params['devenv']: 119 if params['devenv']:
119 templateData['backgroundScripts'].append('devenvPoller__.js') 120 templateData['backgroundScripts'].append('devenvPoller__.js')
120 121
121 if metadata.has_option('general', 'webAccessible') and metadata.get('general ', 'webAccessible') != '': 122 if metadata.has_option('general', 'webAccessible') and metadata.get('general ', 'webAccessible') != '':
122 templateData['webAccessible'] = metadata.get('general', 123 templateData['webAccessible'] = metadata.get('general',
123 'webAccessible').split() 124 'webAccessible').split()
124 125
126 for key in ['externallyConnectable_matches', 'externallyConnectable_ids']:
127 try:
128 values = metadata.get('general', key)
129 if values == '':
130 continue
131
132 sub_key = key.split('_', 1)[1]
133 templateData.setdefault('externallyConnectable', {})
134 templateData['externallyConnectable'][sub_key] = values.split()
135 except ConfigParser.NoOptionError:
136 continue
137
138 # We don't need to configure accept_ts_channel_id if nothing can connect
139 if 'externallyConnectable' in templateData.keys():
140 try:
141 key = 'accepts_tls_channel_id'
142 val = metadata.get('general', 'externallyConnectable_' + key)
143 templateData['externallyConnectable'][key] = val == 'true'
144 except ConfigParser.NoOptionError:
145 pass
146
125 if metadata.has_section('contentScripts'): 147 if metadata.has_section('contentScripts'):
126 contentScripts = [] 148 contentScripts = []
127 for run_at, scripts in metadata.items('contentScripts'): 149 for run_at, scripts in metadata.items('contentScripts'):
128 if scripts == '': 150 if scripts == '':
129 continue 151 continue
130 contentScripts.append({ 152 contentScripts.append({
131 'matches': ['http://*/*', 'https://*/*'], 153 'matches': ['http://*/*', 'https://*/*'],
132 'js': scripts.split(), 154 'js': scripts.split(),
133 'run_at': run_at, 155 'run_at': run_at,
134 'all_frames': True, 156 'all_frames': True,
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 if devenv: 418 if devenv:
397 add_devenv_requirements(files, metadata, params) 419 add_devenv_requirements(files, metadata, params)
398 420
399 zipdata = files.zipToString() 421 zipdata = files.zipToString()
400 signature = None 422 signature = None
401 pubkey = None 423 pubkey = None
402 if keyFile != None: 424 if keyFile != None:
403 signature = signBinary(zipdata, keyFile) 425 signature = signBinary(zipdata, keyFile)
404 pubkey = getPublicKey(keyFile) 426 pubkey = getPublicKey(keyFile)
405 writePackage(outFile, pubkey, signature, zipdata) 427 writePackage(outFile, pubkey, signature, zipdata)
OLDNEW
« no previous file with comments | « no previous file | templates/manifest.json.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld