| 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 packagerGecko and packagerChrome. | 6 # packagers are implemented in packagerGecko and packagerChrome. |
| 7 | 7 |
| 8 import sys | 8 import sys |
| 9 import os | 9 import os |
| 10 import re | 10 import re |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 | 39 |
| 40 def getBuildNum(baseDir): | 40 def getBuildNum(baseDir): |
| 41 try: | 41 try: |
| 42 from buildtools.ensure_dependencies import Mercurial, Git | 42 from buildtools.ensure_dependencies import Mercurial, Git |
| 43 if Mercurial().istype(baseDir): | 43 if Mercurial().istype(baseDir): |
| 44 result = subprocess.check_output(['hg', 'id', '-R', baseDir, '-n']) | 44 result = subprocess.check_output(['hg', 'id', '-R', baseDir, '-n']) |
| 45 return re.sub(r'\D', '', result) | 45 return re.sub(r'\D', '', result) |
| 46 elif Git().istype(baseDir): | 46 elif Git().istype(baseDir): |
| 47 result = subprocess.check_output(['git', 'rev-list', 'HEAD'], cwd=ba
seDir) | 47 result = subprocess.check_output(['git', 'rev-list', 'HEAD'], cwd=ba
seDir) |
| 48 return len(result.splitlines()) | 48 return str(len(result.splitlines())) |
| 49 except subprocess.CalledProcessError: | 49 except subprocess.CalledProcessError: |
| 50 pass | 50 pass |
| 51 | 51 |
| 52 return '0' | 52 return '0' |
| 53 | 53 |
| 54 | 54 |
| 55 def getBuildVersion(baseDir, metadata, releaseBuild, buildNum=None): | 55 def getBuildVersion(baseDir, metadata, releaseBuild, buildNum=None): |
| 56 version = metadata.get('general', 'version') | 56 version = metadata.get('general', 'version') |
| 57 if not releaseBuild: | 57 if not releaseBuild: |
| 58 if buildNum == None: | 58 if buildNum == None: |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 names = self.keys() | 139 names = self.keys() |
| 140 names.sort(key=sortKey) | 140 names.sort(key=sortKey) |
| 141 for name in names: | 141 for name in names: |
| 142 zip.writestr(name, self[name]) | 142 zip.writestr(name, self[name]) |
| 143 zip.close() | 143 zip.close() |
| 144 | 144 |
| 145 def zipToString(self, sortKey=None): | 145 def zipToString(self, sortKey=None): |
| 146 buffer = StringIO() | 146 buffer = StringIO() |
| 147 self.zip(buffer, sortKey=sortKey) | 147 self.zip(buffer, sortKey=sortKey) |
| 148 return buffer.getvalue() | 148 return buffer.getvalue() |
| OLD | NEW |