bug 387437, add --app to specify application, r=KaiRo
authoraxel@pike.org
Tue, 10 Jul 2007 06:55:01 -0700
changeset 3292 7d2ac61a10d1d36868cfc4be928022f9a05a1a48
parent 3291 70c09b56be842a2e36fd333c72e23a335781cd9d
child 3293 259b3bfdb6a59604b8e7c70427d4e15a2be58b08
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersKaiRo
bugs387437
milestone1.9a7pre
bug 387437, add --app to specify application, r=KaiRo
tools/l10n/l10n.py
--- a/tools/l10n/l10n.py
+++ b/tools/l10n/l10n.py
@@ -49,17 +49,17 @@ import sys
 def walk(base):
   for root, dirs, files in os.walk(base):
     try:
       dirs.remove('CVS')
     except ValueError:
       pass
     yield (os.path.normpath(root[len(base)+1:]), files)
 
-def createLocalization(source, dest, apps = ['browser'], exceptions = {}):
+def createLocalization(source, dest, apps, exceptions = {}):
   '''
   Creates a new localization.
 
   @type  source: string
   @param source: path to the mozilla sources to use
 
   @type  dest: string
   @param dest: path to the localization to create or update
@@ -71,16 +71,19 @@ def createLocalization(source, dest, app
   @type  exceptions: mapping
   @param exceptions: stuff to ignore
   '''
 
   assert os.path.isdir(source), "source directory is not a directory"
   clientmk = os.path.join(source,'client.mk')
   assert os.path.isfile(clientmk), "client.mk missing"
 
+  if not apps or not len(apps):
+    apps=['browser']
+
   if not os.path.isdir(dest):
     os.makedirs(dest)
 
   assert os.path.isdir(dest), "target should be a directory"
 
   # get the directories to iterate over
   dirs = set()
   cmd = ['make', '-f', clientmk] + \
@@ -127,21 +130,24 @@ def createLocalization(source, dest, app
         copy2(os.path.join(basepath, root, f), l10npath)
 
 if __name__ == '__main__':
   p = OptionParser()
   p.add_option('--source', default = '.',
                help='Mozilla sources')
   p.add_option('--dest', default = '../l10n',
                help='Localization target directory')
+  p.add_option('--app', action="append",
+               help='Create localization for this application ' + \
+               '(multiple applications allowed, default: browser)')
   p.add_option('-v', '--verbose', action="store_true", default=False,
                help='report debugging information')
   (opts, args) = p.parse_args()
   if opts.verbose:
     logging.basicConfig(level=logging.DEBUG)
   assert len(args) == 1, "language code expected"
   
   # hardcoding exceptions, work for both trunk and 1.8 branch
   exceptions = {'browser':
                 {'searchplugins': '\\.xml$'},
                 'extensions/spellcheck': 'all'}
   createLocalization(opts.source, os.path.join(opts.dest, args[0]),
-                     exceptions=exceptions)
+                     opts.app, exceptions=exceptions)