Index: remoting/tools/build/remoting_copy_locales.py |
diff --git a/chrome/tools/build/repack_locales.py b/remoting/tools/build/remoting_copy_locales.py |
similarity index 57% |
copy from chrome/tools/build/repack_locales.py |
copy to remoting/tools/build/remoting_copy_locales.py |
index a43e17177a8f16037f7a4a8b7e0d41daa9da013a..4d1d41a9f42c6a2967af9b229b057058c789b7d2 100755 |
--- a/chrome/tools/build/repack_locales.py |
+++ b/remoting/tools/build/remoting_copy_locales.py |
@@ -1,5 +1,5 @@ |
#!/usr/bin/env python |
-# Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+# Copyright 2013 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. |
@@ -18,12 +18,8 @@ sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', '..', |
'tools', 'grit')) |
from grit.format import data_pack |
-# The gyp "branding" variable. |
-BRANDING = None |
- |
# Some build paths defined by gyp. |
GRIT_DIR = None |
-SHARE_INT_DIR = None |
INT_DIR = None |
# The target platform. If it is not defined, sys.platform will be used. |
@@ -39,68 +35,22 @@ class Usage(Exception): |
def calc_output(locale): |
"""Determine the file that will be generated for the given locale.""" |
- #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) |
+ #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). Also, 'en-US' should be represented |
- # simply as 'en' (http://crbug.com/19165, http://crbug.com/25578). |
- if locale == 'en-US': |
- locale = 'en' |
- return '%s/repack/%s.lproj/locale.pak' % (INT_DIR, locale.replace('-', '_')) |
+ # 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, 'repack', locale + '.pak') |
+ return os.path.join(INT_DIR, 'remoting_locales', locale + '.pak') |
def calc_inputs(locale): |
"""Determine the files that need processing for the given locale.""" |
inputs = [] |
- #e.g. '<(grit_out_dir)/generated_resources_da.pak' |
- inputs.append(os.path.join(GRIT_DIR, 'generated_resources_%s.pak' % locale)) |
- |
- #e.g. '<(grit_out_dir)/locale_settings_da.pak' |
- inputs.append(os.path.join(GRIT_DIR, 'locale_settings_%s.pak' % locale)) |
- |
- #e.g. '<(grit_out_dir)/platform_locale_settings_da.pak' |
- inputs.append(os.path.join(GRIT_DIR, |
- 'platform_locale_settings_%s.pak' % locale)) |
- |
- #e.g. '<(SHARED_INTERMEDIATE_DIR)/components/strings/ |
- # component_strings_da.pak', |
- inputs.append(os.path.join(SHARE_INT_DIR, 'components', 'strings', |
- 'component_strings_%s.pak' % locale)) |
- |
- if OS != 'ios': |
- #e.g. '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_da.pak' |
- inputs.append(os.path.join(SHARE_INT_DIR, 'webkit', |
- 'webkit_strings_%s.pak' % locale)) |
- |
- #e.g. '<(SHARED_INTERMEDIATE_DIR)/ui/ui_strings_da.pak', |
- inputs.append(os.path.join(SHARE_INT_DIR, 'ui', 'ui_strings', |
- 'ui_strings_%s.pak' % locale)) |
- |
- #e.g. '<(SHARED_INTERMEDIATE_DIR)/ash_strings/ash_strings_da.pak', |
- inputs.append(os.path.join(SHARE_INT_DIR, 'ash_strings', |
- 'ash_strings_%s.pak' % locale)) |
- |
- #e.g. '<(SHARED_INTERMEDIATE_DIR)/device/bluetooth/strings/ |
- # device_bluetooth_strings_da.pak', |
- inputs.append(os.path.join(SHARE_INT_DIR, 'device', 'bluetooth', 'strings', |
- 'device_bluetooth_strings_%s.pak' % locale)) |
- |
- #e.g. '<(SHARED_INTERMEDIATE_DIR)/ui/app_locale_settings_da.pak', |
- inputs.append(os.path.join(SHARE_INT_DIR, 'ui', 'app_locale_settings', |
- 'app_locale_settings_%s.pak' % locale)) |
- |
- #e.g. '<(grit_out_dir)/google_chrome_strings_da.pak' |
- # or |
- # '<(grit_out_dir)/chromium_strings_da.pak' |
- inputs.append(os.path.join( |
- GRIT_DIR, '%s_strings_%s.pak' % (BRANDING, locale))) |
+ #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: |
@@ -140,16 +90,13 @@ def list_inputs(locales): |
def repack_locales(locales): |
""" Loop over and repack the given locales.""" |
for locale in locales: |
- inputs = [] |
- inputs += calc_inputs(locale) |
+ inputs = calc_inputs(locale) |
output = calc_output(locale) |
data_pack.DataPack.RePack(output, inputs) |
def DoMain(argv): |
- global BRANDING |
global GRIT_DIR |
- global SHARE_INT_DIR |
global INT_DIR |
global OS |
global EXTRA_INPUT_FILES |
@@ -163,10 +110,6 @@ 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("-s", action="store", dest="share_int_dir", |
- help="Shared intermediate build files output directory.") |
- parser.add_option("-b", action="store", dest="branding", |
- help="Branding type of this build.") |
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.") |
@@ -181,8 +124,6 @@ def DoMain(argv): |
print_outputs = options.outputs |
GRIT_DIR = options.grit_dir |
INT_DIR = options.int_dir |
- SHARE_INT_DIR = options.share_int_dir |
- BRANDING = options.branding |
EXTRA_INPUT_FILES = options.extra_input |
OS = options.os |
@@ -196,13 +137,14 @@ def DoMain(argv): |
else: |
OS = sys.platform |
- if not (GRIT_DIR and INT_DIR and SHARE_INT_DIR): |
- parser.error('Please specify all of "-g" and "-x" and "-s".\n') |
if print_inputs and print_outputs: |
parser.error('Please specify only one of "-i" or "-o".\n') |
- # Need to know the branding, unless we're just listing the outputs. |
- if not print_outputs and not BRANDING: |
- parser.error('Please specify "-b" to determine the input files.\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) |