OLD | NEW |
1 # coding: utf-8 | 1 # coding: utf-8 |
2 | 2 |
3 # This Source Code Form is subject to the terms of the Mozilla Public | 3 # This Source Code Form is subject to the terms of the Mozilla Public |
4 # License, v. 2.0. If a copy of the MPL was not distributed with this | 4 # License, v. 2.0. If a copy of the MPL was not distributed with this |
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. | 5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
6 | 6 |
7 # Note: These are the base functions common to all packagers, the actual | 7 # Note: These are the base functions common to all packagers, the actual |
8 # packagers are implemented in packagerGecko and packagerChrome. | 8 # packagers are implemented in packagerGecko and packagerChrome. |
9 | 9 |
10 import sys, os, re, codecs, subprocess, json, zipfile | 10 import sys, os, re, codecs, subprocess, json, zipfile |
11 from StringIO import StringIO | 11 from StringIO import StringIO |
12 from chainedconfigparser import ChainedConfigParser | 12 from chainedconfigparser import ChainedConfigParser |
13 | 13 |
14 import buildtools | 14 import buildtools |
15 | 15 |
16 def getDefaultFileName(baseDir, metadata, version, ext): | 16 def getDefaultFileName(metadata, version, ext): |
17 return os.path.join(baseDir, '%s-%s.%s' % (metadata.get('general', 'basename')
, version, ext)) | 17 return '%s-%s.%s' % (metadata.get('general', 'basename'), version, ext) |
18 | 18 |
19 def getMetadataPath(baseDir, type): | 19 def getMetadataPath(baseDir, type): |
20 return os.path.join(baseDir, 'metadata.%s' % type) | 20 return os.path.join(baseDir, 'metadata.%s' % type) |
21 | 21 |
22 def readMetadata(baseDir, type): | 22 def readMetadata(baseDir, type): |
23 return ChainedConfigParser(getMetadataPath(baseDir, type)) | 23 return ChainedConfigParser(getMetadataPath(baseDir, type)) |
24 | 24 |
25 def getBuildNum(baseDir): | 25 def getBuildNum(baseDir): |
26 try: | 26 try: |
27 from buildtools.ensure_dependencies import Mercurial, Git | 27 from buildtools.ensure_dependencies import Mercurial, Git |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 names = self.keys() | 123 names = self.keys() |
124 names.sort(key=sortKey) | 124 names.sort(key=sortKey) |
125 for name in names: | 125 for name in names: |
126 zip.writestr(name, self[name]) | 126 zip.writestr(name, self[name]) |
127 zip.close() | 127 zip.close() |
128 | 128 |
129 def zipToString(self, sortKey=None): | 129 def zipToString(self, sortKey=None): |
130 buffer = StringIO() | 130 buffer = StringIO() |
131 self.zip(buffer, sortKey=sortKey) | 131 self.zip(buffer, sortKey=sortKey) |
132 return buffer.getvalue() | 132 return buffer.getvalue() |
OLD | NEW |