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

Side by Side Diff: packagerGecko.py

Issue 9257092: More build tools improvements (Closed)
Patch Set: Added some more changes required to build Firefox and Chrome extensions from the same repository (s… Created Jan. 25, 2013, 1:47 p.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 | « packagerChrome.py ('k') | no next file » | 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,
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 118
119 for locale in locales: 119 for locale in locales:
120 data = SafeConfigParser() 120 data = SafeConfigParser()
121 data.optionxform = str 121 data.optionxform = str
122 try: 122 try:
123 result[locale] = localeTools.readFile(os.path.join(getLocalesDir(baseDir), locale, 'meta.properties')) 123 result[locale] = localeTools.readFile(os.path.join(getLocalesDir(baseDir), locale, 'meta.properties'))
124 except: 124 except:
125 result[locale] = {} 125 result[locale] = {}
126 return result 126 return result
127 127
128 def getContributors(baseDir, metadata): 128 def getContributors(metadata):
129 main = [] 129 main = []
130 additional = set() 130 additional = set()
131 if metadata.has_section('contributors'): 131 if metadata.has_section('contributors'):
132 options = metadata.options('contributors') 132 options = metadata.options('contributors')
133 options.sort() 133 options.sort()
134 for option in options: 134 for option in options:
135 value = metadata.get('contributors', option) 135 value = metadata.get('contributors', option)
136 if re.search(r'\D', option): 136 if re.search(r'\D', option):
137 match = re.search(r'^\s*(\S+)\s+//([^/\s]+)/@(\S+)\s*$', value) 137 match = re.search(r'^\s*(\S+)\s+//([^/\s]+)/@(\S+)\s*$', value)
138 if not match: 138 if not match:
139 print >>sys.stderr, 'Warning: unrecognized contributor location "%s"\n ' % value 139 print >>sys.stderr, 'Warning: unrecognized contributor location "%s"\n ' % value
140 continue 140 continue
141 dom = minidom.parse(os.path.join(baseDir, match.group(1))) 141 baseDir = os.path.dirname(metadata.option_source('contributors', option) )
142 parts = match.group(1).split('/')
143 dom = minidom.parse(os.path.join(baseDir, *parts))
142 tags = dom.getElementsByTagName(match.group(2)) 144 tags = dom.getElementsByTagName(match.group(2))
143 for tag in tags: 145 for tag in tags:
144 if tag.hasAttribute(match.group(3)): 146 if tag.hasAttribute(match.group(3)):
145 for name in re.split(r'\s*,\s*', tag.getAttribute(match.group(3))): 147 for name in re.split(r'\s*,\s*', tag.getAttribute(match.group(3))):
146 additional.add(name) 148 additional.add(name)
147 else: 149 else:
148 main.append(value) 150 main.append(value)
149 return main + sorted(additional, key=unicode.lower) 151 return main + sorted(additional, key=unicode.lower)
150 152
151 def initTranslators(localeMetadata): 153 def initTranslators(localeMetadata):
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 locales = getLocales(baseDir) 301 locales = getLocales(baseDir)
300 elif locales == 'all': 302 elif locales == 'all':
301 locales = getLocales(baseDir, True) 303 locales = getLocales(baseDir, True)
302 304
303 metadata = readMetadata(baseDir) 305 metadata = readMetadata(baseDir)
304 version = getBuildVersion(baseDir, metadata, releaseBuild, buildNum) 306 version = getBuildVersion(baseDir, metadata, releaseBuild, buildNum)
305 307
306 if outFile == None: 308 if outFile == None:
307 outFile = getDefaultFileName(baseDir, metadata, version, 'xpi') 309 outFile = getDefaultFileName(baseDir, metadata, version, 'xpi')
308 310
309 contributors = getContributors(baseDir, metadata) 311 contributors = getContributors(metadata)
310 312
311 params = { 313 params = {
312 'baseDir': baseDir, 314 'baseDir': baseDir,
313 'locales': locales, 315 'locales': locales,
314 'releaseBuild': releaseBuild, 316 'releaseBuild': releaseBuild,
315 'version': version.encode('utf-8'), 317 'version': version.encode('utf-8'),
316 'metadata': metadata, 318 'metadata': metadata,
317 'contributors': contributors, 319 'contributors': contributors,
318 'multicompartment': multicompartment, 320 'multicompartment': multicompartment,
319 } 321 }
320 322
321 files = Files(getPackageFiles(params), getIgnoredFiles(params), 323 files = Files(getPackageFiles(params), getIgnoredFiles(params),
322 process=lambda path, data: processFile(path, data, params)) 324 process=lambda path, data: processFile(path, data, params))
323 files['install.rdf'] = createManifest(params) 325 files['install.rdf'] = createManifest(params)
324 if metadata.has_section('mapping'): 326 if metadata.has_section('mapping'):
325 files.readMappedFiles(baseDir, metadata.items('mapping')) 327 files.readMappedFiles(metadata.items('mapping'))
326 files.read(baseDir, skip=('chrome')) 328 files.read(baseDir, skip=('chrome'))
327 for name, path in getChromeSubdirs(baseDir, params['locales']).iteritems(): 329 for name, path in getChromeSubdirs(baseDir, params['locales']).iteritems():
328 if os.path.isdir(path): 330 if os.path.isdir(path):
329 files.read(path, 'chrome/%s' % name) 331 files.read(path, 'chrome/%s' % name)
330 fixupLocales(params, files) 332 fixupLocales(params, files)
331 if not 'bootstrap.js' in files: 333 if not 'bootstrap.js' in files:
332 addMissingFiles(params, files) 334 addMissingFiles(params, files)
333 if keyFile: 335 if keyFile:
334 signFiles(files, keyFile) 336 signFiles(files, keyFile)
335 files.zip(outFile, sortKey=lambda x: '!' if x == 'META-INF/zigbert.rsa' else x ) 337 files.zip(outFile, sortKey=lambda x: '!' if x == 'META-INF/zigbert.rsa' else x )
336 338
337 def autoInstall(baseDir, host, port, multicompartment=False): 339 def autoInstall(baseDir, host, port, multicompartment=False):
338 fileBuffer = StringIO() 340 fileBuffer = StringIO()
339 createBuild(baseDir, outFile=fileBuffer, multicompartment=multicompartment) 341 createBuild(baseDir, outFile=fileBuffer, multicompartment=multicompartment)
340 urllib.urlopen('http://%s:%s/' % (host, port), data=fileBuffer.getvalue()) 342 urllib.urlopen('http://%s:%s/' % (host, port), data=fileBuffer.getvalue())
OLDNEW
« no previous file with comments | « packagerChrome.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld