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

Delta Between Two Patch Sets: packager.py

Issue 29696596: Issue 6383 - introduce switchable app_id (Closed) Base URL: https://hg.adblockplus.org/buildtools/rev/097b8d9c43a8
Left Patch Set: Created Feb. 13, 2018, 3:51 p.m.
Right Patch Set: Created Feb. 14, 2018, 10:49 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | packagerChrome.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
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 # Note: These are the base functions common to all packagers, the actual 5 # Note: These are the base functions common to all packagers, the actual
6 # packagers are implemented in packagerChrome and packagerEdge. 6 # packagers are implemented in packagerChrome and packagerEdge.
7 7
8 import sys 8 import sys
9 import os 9 import os
10 import re 10 import re
(...skipping 22 matching lines...) Expand all
33 try: 33 try:
34 if has_key_file: 34 if has_key_file:
35 key = 'signed' 35 key = 'signed'
36 else: 36 else:
37 key = 'unsigned' 37 key = 'unsigned'
38 extension = extension[key] 38 extension = extension[key]
39 except (KeyError, TypeError): 39 except (KeyError, TypeError):
40 pass 40 pass
41 41
42 return extension 42 return extension
43
44
45 def get_app_id(release_build, metadata):
46 """Lookup the correct app_id for a build."""
47 suffix = 'release' if release_build else 'devbuild'
48 app_id_option = 'app_id_' + suffix
49
50 return metadata.get('general', app_id_option)
43 51
44 52
45 def getMetadataPath(baseDir, type): 53 def getMetadataPath(baseDir, type):
46 return os.path.join(baseDir, 'metadata.%s' % type) 54 return os.path.join(baseDir, 'metadata.%s' % type)
47 55
48 56
49 def getDevEnvPath(baseDir, type): 57 def getDevEnvPath(baseDir, type):
50 return os.path.join(baseDir, 'devenv.' + type) 58 return os.path.join(baseDir, 'devenv.' + type)
51 59
52 60
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 164
157 def zip(self, outFile, sortKey=None, compression=zipfile.ZIP_DEFLATED): 165 def zip(self, outFile, sortKey=None, compression=zipfile.ZIP_DEFLATED):
158 with zipfile.ZipFile(outFile, 'w', compression) as zf: 166 with zipfile.ZipFile(outFile, 'w', compression) as zf:
159 for name in sorted(self, key=sortKey): 167 for name in sorted(self, key=sortKey):
160 zf.writestr(name, self[name]) 168 zf.writestr(name, self[name])
161 169
162 def zipToString(self, sortKey=None): 170 def zipToString(self, sortKey=None):
163 buffer = StringIO() 171 buffer = StringIO()
164 self.zip(buffer, sortKey=sortKey) 172 self.zip(buffer, sortKey=sortKey)
165 return buffer.getvalue() 173 return buffer.getvalue()
LEFTRIGHT
« no previous file | packagerChrome.py » ('j') | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld