OLD | NEW |
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 24 matching lines...) Expand all Loading... |
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 | 43 |
44 | 44 |
| 45 def get_build_specific_option(release_build, metadata, prefix): |
| 46 suffix = 'release' if release_build else 'devbuild' |
| 47 return metadata.get('general', '{}_{}'.format(prefix, suffix)) |
| 48 |
| 49 |
45 def get_app_id(release_build, metadata): | 50 def get_app_id(release_build, metadata): |
46 """Lookup the correct app_id for a build.""" | 51 return get_build_specific_option(release_build, metadata, 'app_id') |
47 suffix = 'release' if release_build else 'devbuild' | |
48 app_id_option = 'app_id_' + suffix | |
49 | |
50 return metadata.get('general', app_id_option) | |
51 | 52 |
52 | 53 |
53 def getMetadataPath(baseDir, type): | 54 def getMetadataPath(baseDir, type): |
54 return os.path.join(baseDir, 'metadata.%s' % type) | 55 return os.path.join(baseDir, 'metadata.%s' % type) |
55 | 56 |
56 | 57 |
57 def getDevEnvPath(baseDir, type): | 58 def getDevEnvPath(baseDir, type): |
58 return os.path.join(baseDir, 'devenv.' + type) | 59 return os.path.join(baseDir, 'devenv.' + type) |
59 | 60 |
60 | 61 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 168 |
168 def zip(self, outFile, sortKey=None, compression=zipfile.ZIP_DEFLATED): | 169 def zip(self, outFile, sortKey=None, compression=zipfile.ZIP_DEFLATED): |
169 with zipfile.ZipFile(outFile, 'w', compression) as zf: | 170 with zipfile.ZipFile(outFile, 'w', compression) as zf: |
170 for name in sorted(self, key=sortKey): | 171 for name in sorted(self, key=sortKey): |
171 zf.writestr(name, self[name]) | 172 zf.writestr(name, self[name]) |
172 | 173 |
173 def zipToString(self, sortKey=None): | 174 def zipToString(self, sortKey=None): |
174 buffer = StringIO() | 175 buffer = StringIO() |
175 self.zip(buffer, sortKey=sortKey) | 176 self.zip(buffer, sortKey=sortKey) |
176 return buffer.getvalue() | 177 return buffer.getvalue() |
OLD | NEW |