| Index: chromecast/tools/build/chromecast_repack_locales.py
|
| diff --git a/remoting/tools/build/remoting_copy_locales.py b/chromecast/tools/build/chromecast_repack_locales.py
|
| similarity index 64%
|
| copy from remoting/tools/build/remoting_copy_locales.py
|
| copy to chromecast/tools/build/chromecast_repack_locales.py
|
| index 4d1d41a9f42c6a2967af9b229b057058c789b7d2..607930a7c2173ade06f0f2d0f77b4ca39b38e901 100755
|
| --- a/remoting/tools/build/remoting_copy_locales.py
|
| +++ b/chromecast/tools/build/chromecast_repack_locales.py
|
| @@ -1,5 +1,5 @@
|
| #!/usr/bin/env python
|
| -# Copyright 2013 The Chromium Authors. All rights reserved.
|
| +# Copyright 2014 The Chromium Authors. All rights reserved.
|
| # Use of this source code is governed by a BSD-style license that can be
|
| # found in the LICENSE file.
|
|
|
| @@ -21,12 +21,7 @@ from grit.format import data_pack
|
| # Some build paths defined by gyp.
|
| GRIT_DIR = None
|
| INT_DIR = None
|
| -
|
| -# The target platform. If it is not defined, sys.platform will be used.
|
| -OS = None
|
| -
|
| -# Extra input files.
|
| -EXTRA_INPUT_FILES = []
|
| +CHROMECAST_BRANDING = None
|
|
|
| class Usage(Exception):
|
| def __init__(self, msg):
|
| @@ -35,27 +30,20 @@ class Usage(Exception):
|
|
|
| def calc_output(locale):
|
| """Determine the file that will be generated for the given locale."""
|
| - #e.g. '<(INTERMEDIATE_DIR)/remoting_locales/da.pak',
|
| - if OS == 'mac' or OS == 'ios':
|
| - # For Cocoa to find the locale at runtime, it needs to use '_' instead
|
| - # of '-' (http://crbug.com/20441).
|
| - return os.path.join(INT_DIR, 'remoting', 'resources',
|
| - '%s.lproj' % locale.replace('-', '_'), 'locale.pak')
|
| - else:
|
| - return os.path.join(INT_DIR, 'remoting_locales', locale + '.pak')
|
| + #e.g. '<(INTERMEDIATE_DIR)/repack/da.pak',
|
| + # For Fake Bidi, generate it at a fixed path so that tests can safely
|
| + # reference it.
|
| + if locale == 'fake-bidi':
|
| + return '%s/%s.pak' % (INT_DIR, locale)
|
| + return os.path.join(INT_DIR, locale + '.pak')
|
|
|
|
|
| def calc_inputs(locale):
|
| """Determine the files that need processing for the given locale."""
|
| inputs = []
|
| -
|
| - #e.g. '<(grit_out_dir)/remoting/resources/da.pak'
|
| - inputs.append(os.path.join(GRIT_DIR, 'remoting/resources/%s.pak' % locale))
|
| -
|
| - # Add any extra input files.
|
| - for extra_file in EXTRA_INPUT_FILES:
|
| - inputs.append('%s_%s.pak' % (extra_file, locale))
|
| -
|
| + if CHROMECAST_BRANDING == 'Chrome':
|
| + inputs.append(os.path.join(GRIT_DIR, 'app_strings_%s.pak' % locale))
|
| + inputs.append(os.path.join(GRIT_DIR, 'chromecast_settings_%s.pak' % locale))
|
| return inputs
|
|
|
|
|
| @@ -90,16 +78,16 @@ def list_inputs(locales):
|
| def repack_locales(locales):
|
| """ Loop over and repack the given locales."""
|
| for locale in locales:
|
| - inputs = calc_inputs(locale)
|
| + inputs = []
|
| + inputs += calc_inputs(locale)
|
| output = calc_output(locale)
|
| data_pack.DataPack.RePack(output, inputs)
|
|
|
|
|
| def DoMain(argv):
|
| + global CHROMECAST_BRANDING
|
| global GRIT_DIR
|
| global INT_DIR
|
| - global OS
|
| - global EXTRA_INPUT_FILES
|
|
|
| parser = optparse.OptionParser("usage: %prog [options] locales")
|
| parser.add_option("-i", action="store_true", dest="inputs", default=False,
|
| @@ -110,11 +98,8 @@ def DoMain(argv):
|
| help="GRIT build files output directory.")
|
| parser.add_option("-x", action="store", dest="int_dir",
|
| help="Intermediate build files output directory.")
|
| - parser.add_option("-e", action="append", dest="extra_input", default=[],
|
| - help="Full path to an extra input pak file without the\
|
| - locale suffix and \".pak\" extension.")
|
| - parser.add_option("-p", action="store", dest="os",
|
| - help="The target OS. (e.g. mac, linux, win, etc.)")
|
| + parser.add_option("-b", action="store", dest="chromecast_branding",
|
| + help="Chromecast branding ('Chrome' or 'Chromium').")
|
| options, locales = parser.parse_args(argv)
|
|
|
| if not locales:
|
| @@ -124,27 +109,14 @@ def DoMain(argv):
|
| print_outputs = options.outputs
|
| GRIT_DIR = options.grit_dir
|
| INT_DIR = options.int_dir
|
| - EXTRA_INPUT_FILES = options.extra_input
|
| - OS = options.os
|
| -
|
| - if not OS:
|
| - if sys.platform == 'darwin':
|
| - OS = 'mac'
|
| - elif sys.platform.startswith('linux'):
|
| - OS = 'linux'
|
| - elif sys.platform in ('cygwin', 'win32'):
|
| - OS = 'win'
|
| - else:
|
| - OS = sys.platform
|
| + CHROMECAST_BRANDING = options.chromecast_branding
|
|
|
| + if CHROMECAST_BRANDING != "Chrome" and CHROMECAST_BRANDING != "Chromium":
|
| + parser.error('Chromecast branding (-b) must be "Chrome" or "Chromium".\n')
|
| + if not (GRIT_DIR and INT_DIR):
|
| + parser.error('Please specify all of "-g" and "-x".\n')
|
| if print_inputs and print_outputs:
|
| parser.error('Please specify only one of "-i" or "-o".\n')
|
| - if print_inputs and not GRIT_DIR:
|
| - parser.error('Please specify "-g".\n')
|
| - if print_outputs and not INT_DIR:
|
| - parser.error('Please specify "-x".\n')
|
| - if not (print_inputs or print_outputs or (GRIT_DIR and INT_DIR)):
|
| - parser.error('Please specify both "-g" and "-x".\n')
|
|
|
| if print_inputs:
|
| return list_inputs(locales)
|
|
|