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

Side by Side Diff: packager.py

Issue 9259023: Use platform-dependent metadata files to allow multiple builds from the same repository (Closed)
Patch Set: Created Jan. 25, 2013, 7:10 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build.py ('k') | packagerChrome.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # coding: utf-8 1 # coding: utf-8
2 2
3 # This file is part of the Adblock Plus build tools, 3 # This file is part of the Adblock Plus build tools,
4 # Copyright (C) 2006-2012 Eyeo GmbH 4 # Copyright (C) 2006-2012 Eyeo GmbH
5 # 5 #
6 # Adblock Plus is free software: you can redistribute it and/or modify 6 # Adblock Plus is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License version 3 as 7 # it under the terms of the GNU General Public License version 3 as
8 # published by the Free Software Foundation. 8 # published by the Free Software Foundation.
9 # 9 #
10 # Adblock Plus is distributed in the hope that it will be useful, 10 # Adblock Plus is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details. 13 # GNU General Public License for more details.
14 # 14 #
15 # You should have received a copy of the GNU General Public License 15 # You should have received a copy of the GNU General Public License
16 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 16 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
17 17
18 # Note: These are the base functions common to all packagers, the actual 18 # Note: These are the base functions common to all packagers, the actual
19 # packagers are implemented in packagerGecko and packagerChrome. 19 # packagers are implemented in packagerGecko and packagerChrome.
20 20
21 import sys, os, re, codecs, subprocess, json, zipfile, jinja2 21 import sys, os, re, codecs, subprocess, json, zipfile, jinja2
22 from StringIO import StringIO 22 from StringIO import StringIO
23 from chainedconfigparser import ChainedConfigParser 23 from chainedconfigparser import ChainedConfigParser
24 24
25 import buildtools 25 import buildtools
26 26
27 def getDefaultFileName(baseDir, metadata, version, ext): 27 def getDefaultFileName(baseDir, metadata, version, ext):
28 return os.path.join(baseDir, '%s-%s.%s' % (metadata.get('general', 'basename') , version, ext)) 28 return os.path.join(baseDir, '%s-%s.%s' % (metadata.get('general', 'basename') , version, ext))
29 29
30 def getMetadataPath(baseDir): 30 def getMetadataPath(baseDir, type):
31 return os.path.join(baseDir, 'metadata') 31 return os.path.join(baseDir, 'metadata.%s' % type)
32 32
33 def readMetadata(baseDir): 33 def readMetadata(baseDir, type):
34 return ChainedConfigParser(getMetadataPath(baseDir)) 34 return ChainedConfigParser(getMetadataPath(baseDir, type))
35 35
36 def getBuildNum(baseDir): 36 def getBuildNum(baseDir):
37 try: 37 try:
38 (result, dummy) = subprocess.Popen(['hg', 'id', '-R', baseDir, '-n'], stdout =subprocess.PIPE).communicate() 38 (result, dummy) = subprocess.Popen(['hg', 'id', '-R', baseDir, '-n'], stdout =subprocess.PIPE).communicate()
39 return re.sub(r'\D', '', result) 39 return re.sub(r'\D', '', result)
40 except Exception: 40 except Exception:
41 return '0' 41 return '0'
42 42
43 def getBuildVersion(baseDir, metadata, releaseBuild, buildNum=None): 43 def getBuildVersion(baseDir, metadata, releaseBuild, buildNum=None):
44 version = metadata.get('general', 'version') 44 version = metadata.get('general', 'version')
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 data = self[name] 111 data = self[name]
112 if self.process: 112 if self.process:
113 data = self.process(name, data) 113 data = self.process(name, data)
114 zip.writestr(name, data) 114 zip.writestr(name, data)
115 zip.close() 115 zip.close()
116 116
117 def zipToString(self, sortKey=None): 117 def zipToString(self, sortKey=None):
118 buffer = StringIO() 118 buffer = StringIO()
119 self.zip(buffer, sortKey=sortKey) 119 self.zip(buffer, sortKey=sortKey)
120 return buffer.getvalue() 120 return buffer.getvalue()
OLDNEW
« no previous file with comments | « build.py ('k') | packagerChrome.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld