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

Unified Diff: build.py

Issue 5944359652425728: Issue 2109 - Drop assumption that metadata format depends on platform (Closed)
Patch Set: Created March 9, 2015, 7:37 p.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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build.py
===================================================================
--- a/build.py
+++ b/build.py
@@ -237,98 +237,103 @@ def createDevEnv(baseDir, scriptName, op
def setupTranslations(baseDir, scriptName, opts, args, type):
if len(args) < 1:
print 'Project key is required to update translation master files.'
usage(scriptName, type, 'setuptrans')
return
key = args[0]
+ from buildtools.packager import readMetadata
+ metadata = readMetadata(baseDir, type)
+ basename = metadata.get('general', 'basename')
+
if type == 'chrome' or type == 'opera':
import buildtools.packagerChrome as packager
locales = os.listdir(os.path.join(baseDir, '_locales'))
locales = map(lambda locale: locale.replace('_', '-'), locales)
- basename = packager.readMetadata(baseDir, type).get('general', 'basename')
else:
import buildtools.packagerGecko as packager
locales = packager.getLocales(baseDir, True)
- basename = packager.readMetadata(baseDir, type).get('general', 'basename')
import buildtools.localeTools as localeTools
localeTools.setupTranslations(type, locales, basename, key)
def updateTranslationMaster(baseDir, scriptName, opts, args, type):
if len(args) < 1:
print 'Project key is required to update translation master files.'
usage(scriptName, type, 'translate')
return
key = args[0]
+ from buildtools.packager import readMetadata
+ metadata = readMetadata(baseDir, type)
+ basename = metadata.get('general', 'basename')
+
if type == 'chrome' or type == 'opera':
import buildtools.packagerChrome as packager
defaultLocaleDir = os.path.join(baseDir, '_locales', packager.defaultLocale)
- metadata = packager.readMetadata(baseDir, type)
- basename = metadata.get('general', 'basename')
else:
import buildtools.packagerGecko as packager
defaultLocaleDir = os.path.join(packager.getLocalesDir(baseDir), packager.defaultLocale)
- metadata = packager.readMetadata(baseDir, type)
- basename = metadata.get('general', 'basename')
import buildtools.localeTools as localeTools
localeTools.updateTranslationMaster(type, metadata, defaultLocaleDir, basename, key)
def uploadTranslations(baseDir, scriptName, opts, args, type):
if len(args) < 1:
print 'Project key is required to upload existing translations.'
usage(scriptName, type, 'uploadtrans')
return
key = args[0]
+ from buildtools.packager import readMetadata
+ metadata = readMetadata(baseDir, type)
+ basename = metadata.get('general', 'basename')
+
if type == 'chrome' or type == 'opera':
import buildtools.packagerChrome as packager
localesDir = os.path.join(baseDir, '_locales')
locales = os.listdir(localesDir)
locales = map(lambda locale: (locale.replace('_', '-'), os.path.join(localesDir, locale)), locales)
- metadata = packager.readMetadata(baseDir, type)
- basename = metadata.get('general', 'basename')
else:
import buildtools.packagerGecko as packager
localesDir = packager.getLocalesDir(baseDir)
locales = packager.getLocales(baseDir, True)
locales = map(lambda locale: (locale, os.path.join(localesDir, locale)), locales)
- metadata = packager.readMetadata(baseDir, type)
- basename = metadata.get('general', 'basename')
import buildtools.localeTools as localeTools
for locale, localeDir in locales:
if locale != packager.defaultLocale:
localeTools.uploadTranslations(type, metadata, localeDir, locale, basename, key)
def getTranslations(baseDir, scriptName, opts, args, type):
if len(args) < 1:
print 'Project key is required to update translation master files.'
usage(scriptName, type, 'translate')
return
+ from buildtools.packager import readMetadata
+ metadata = readMetadata(baseDir, type)
+ basename = metadata.get('general', 'basename')
+
key = args[0]
if type == 'chrome' or type == 'opera':
import buildtools.packagerChrome as packager
localesDir = os.path.join(baseDir, '_locales')
else:
import buildtools.packagerGecko as packager
localesDir = packager.getLocalesDir(baseDir)
import buildtools.localeTools as localeTools
- basename = packager.readMetadata(baseDir, type).get('general', 'basename')
localeTools.getTranslations(type, localesDir, packager.defaultLocale.replace('_', '-'), basename, key)
def showDescriptions(baseDir, scriptName, opts, args, type):
locales = None
for option, value in opts:
if option in ('-l', '--locales'):
locales = value.split(',')
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld