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

Unified Diff: packagerKMeleon.py

Issue 8627097: Moved Chrome extension scripts to buildtools repository (Closed)
Patch Set: Created Oct. 19, 2012, 10:42 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « packagerGecko.py ('k') | publicSuffixListUpdater.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packagerKMeleon.py
===================================================================
--- a/packagerKMeleon.py
+++ b/packagerKMeleon.py
@@ -1,16 +1,16 @@
# coding: utf-8
# This Source Code is subject to the terms of the Mozilla Public License
# version 2.0 (the "License"). You can obtain a copy of the License at
# http://mozilla.org/MPL/2.0/.
import os, subprocess, re, tempfile, shutil, json
-import buildtools.packager as packager
+import buildtools.packagerGecko as packagerBase
libs = (
'libcmt.lib', 'kernel32.lib', 'user32.lib', 'gdi32.lib', 'comctl32.lib',
'nspr4.lib', 'plds4.lib', 'plc4.lib', 'xpcom.lib', 'xpcomglue_s.lib',
'embed_base_s.lib', 'unicharutil_external_s.lib', 'js3250.lib'
)
compileflags = ('-c', '-O1', '-W3', '-MT', '-DXP_WIN', '-Zc:wchar_t-')
linkflags = ('-DLL', '-NODEFAULTLIB', '-NOLOGO')
@@ -87,97 +87,97 @@ def buildDLL(baseDir, fileName, version)
handle = open(outFile, 'rb')
result = handle.read()
handle.close()
return result
finally:
shutil.rmtree(tempDir, ignore_errors=True)
def createManifest(baseExtDir, params):
- localeMetadata = packager.readLocaleMetadata(baseExtDir, params['locales'])
+ localeMetadata = packagerBase.readLocaleMetadata(baseExtDir, params['locales'])
manifest = {}
metadata = params['metadata']
manifest['id'] = metadata.get('general', 'id')
manifest['version'] = metadata.get('general', 'version')
manifest['version'] = params['version']
- manifest['name'] = localeMetadata[packager.defaultLocale]['name']
- manifest['description'] = localeMetadata[packager.defaultLocale]['description']
+ manifest['name'] = localeMetadata[packagerBase.defaultLocale]['name']
+ manifest['description'] = localeMetadata[packagerBase.defaultLocale]['description']
manifest['creator'] = metadata.get('general', 'author')
manifest['homepage'] = metadata.get('homepage', 'default')
if metadata.has_section('contributors'):
manifest['contributors'] = map(lambda item: item[1], metadata.items('contributors'))
manifest['contributors'].sort()
else:
manifest['contributors'] = []
- manifest['translators'] = packager.getTranslators(localeMetadata)
+ manifest['translators'] = packagerBase.getTranslators(localeMetadata)
return 'var EXPORTED_SYMBOLS = ["manifest"];\nvar manifest = ' + json.dumps(manifest)
def processChromeManifest(data, baseName):
# Manifest location is different in K-Meleon, update paths
data = re.sub(r'jar:chrome/', 'jar:', data)
data = re.sub(r'(\s)modules/', r'\1../modules/%s/' % baseName, data)
data = re.sub(r'(\s)defaults/', r'\1../defaults/', data)
return data
def createBuild(baseDir, outFile=None, locales=None, buildNum=None, releaseBuild=False):
if buildNum == None:
- buildNum = packager.getBuildNum(baseDir)
+ buildNum = packagerBase.getBuildNum(baseDir)
baseExtDir = getBaseExtensionDir(baseDir)
if locales == None:
- locales = packager.getLocales(baseExtDir)
+ locales = packagerBase.getLocales(baseExtDir)
elif locales == 'all':
- locales = packager.getLocales(baseExtDir, True)
+ locales = packagerBase.getLocales(baseExtDir, True)
- metadata = packager.readMetadata(baseExtDir)
+ metadata = packagerBase.readMetadata(baseExtDir)
version = metadata.get('general', 'version')
if not releaseBuild:
version += '.' + buildNum
params = {
'locales': locales,
'releaseBuild': releaseBuild,
'buildNum': buildNum,
'version': version.encode('utf-8'),
'metadata': metadata,
'limitMetadata': False,
}
baseName = metadata.get('general', 'baseName')
chromeFiles = {}
for xulFile in getXULFiles(baseDir):
- packager.readFile(chromeFiles, params, xulFile, 'content/ui/%s' % os.path.basename(xulFile))
+ packagerBase.readFile(chromeFiles, params, xulFile, 'content/ui/%s' % os.path.basename(xulFile))
files = {}
files['modules/%s/Manifest.jsm' % baseName] = createManifest(baseExtDir, params)
files['kplugins/%s.dll' % baseName] = buildDLL(baseDir, '%s.dll' % baseName, version)
- files['chrome/%s.jar' % baseName] = packager.createChromeJar(baseExtDir, params, files=chromeFiles)
+ files['chrome/%s.jar' % baseName] = packagerBase.createChromeJar(baseExtDir, params, files=chromeFiles)
- packager.readFile(files, params, os.path.join(baseExtDir, 'chrome.manifest'), 'chrome/%s.manifest' % baseName)
+ packagerBase.readFile(files, params, os.path.join(baseExtDir, 'chrome.manifest'), 'chrome/%s.manifest' % baseName)
files['chrome/%s.manifest' % baseName] = processChromeManifest(files['chrome/%s.manifest' % baseName], baseName)
for macroFile in getMacroFiles(baseDir):
- packager.readFile(files, params, macroFile, 'macros/%s' % os.path.basename(macroFile))
+ packagerBase.readFile(files, params, macroFile, 'macros/%s' % os.path.basename(macroFile))
for interfaceFile in getInterfaceFiles(baseDir):
- packager.readFile(files, params, interfaceFile, 'components/%s' % os.path.basename(interfaceFile))
+ packagerBase.readFile(files, params, interfaceFile, 'components/%s' % os.path.basename(interfaceFile))
for moduleFile in getModuleFiles(baseDir):
- packager.readFile(files, params, moduleFile, 'modules/%s/%s' % (baseName, os.path.basename(moduleFile)))
+ packagerBase.readFile(files, params, moduleFile, 'modules/%s/%s' % (baseName, os.path.basename(moduleFile)))
for prefsFile in getPrefsFiles(baseDir):
- packager.readFile(files, params, prefsFile, 'defaults/pref/%s' % os.path.basename(prefsFile))
+ packagerBase.readFile(files, params, prefsFile, 'defaults/pref/%s' % os.path.basename(prefsFile))
- packager.readFile(files, params, os.path.join(baseExtDir, 'defaults'), 'defaults')
- packager.readFile(files, params, os.path.join(baseExtDir, 'modules'), 'modules/%s' %baseName)
+ packagerBase.readFile(files, params, os.path.join(baseExtDir, 'defaults'), 'defaults')
+ packagerBase.readFile(files, params, os.path.join(baseExtDir, 'modules'), 'modules/%s' %baseName)
# Correct files names (defaults/preferences/ => defaults/pref/)
newFiles = {}
for key, value in files.iteritems():
if key.startswith('defaults/preferences/'):
key = 'defaults/pref/' + key[len('defaults/preferences/'):]
newFiles[key] = value
files = newFiles
# Allow local metadata to overrite settings from base extension
- metadata.read(packager.getMetadataPath(baseDir))
+ metadata.read(packagerBase.getMetadataPath(baseDir))
if outFile == None:
- outFile = packager.getDefaultFileName(baseDir, metadata, version, 'zip')
+ outFile = packagerBase.getDefaultFileName(baseDir, metadata, version, 'zip')
- packager.writeXPI(files, outFile)
+ packagerBase.writeXPI(files, outFile)
« no previous file with comments | « packagerGecko.py ('k') | publicSuffixListUpdater.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld