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_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) |
| 51 |
| 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 |
53 def readMetadata(baseDir, type): | 61 def readMetadata(baseDir, type): |
54 parser = ChainedConfigParser() | 62 parser = ChainedConfigParser() |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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() |
OLD | NEW |