Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: chromecast/tools/build/chromecast_repack_locales.py

Issue 1266723002: Revert of [Chromecast] Change chromecast_branding to public (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chromecast/media/media.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Helper script to repack paks for a list of locales. 6 """Helper script to repack paks for a list of locales.
7 7
8 Gyp doesn't have any built-in looping capability, so this just provides a way to 8 Gyp doesn't have any built-in looping capability, so this just provides a way to
9 loop over a list of locales when repacking pak files, thus avoiding a 9 loop over a list of locales when repacking pak files, thus avoiding a
10 proliferation of mostly duplicate, cut-n-paste gyp actions. 10 proliferation of mostly duplicate, cut-n-paste gyp actions.
(...skipping 23 matching lines...) Expand all
34 # For Fake Bidi, generate it at a fixed path so that tests can safely 34 # For Fake Bidi, generate it at a fixed path so that tests can safely
35 # reference it. 35 # reference it.
36 if locale == 'fake-bidi': 36 if locale == 'fake-bidi':
37 return '%s/%s.pak' % (INT_DIR, locale) 37 return '%s/%s.pak' % (INT_DIR, locale)
38 return os.path.join(INT_DIR, locale + '.pak') 38 return os.path.join(INT_DIR, locale + '.pak')
39 39
40 40
41 def calc_inputs(locale): 41 def calc_inputs(locale):
42 """Determine the files that need processing for the given locale.""" 42 """Determine the files that need processing for the given locale."""
43 inputs = [] 43 inputs = []
44 if CHROMECAST_BRANDING != 'public': 44 if CHROMECAST_BRANDING == 'Chrome':
45 inputs.append(os.path.join(GRIT_DIR, 'app_strings_%s.pak' % locale)) 45 inputs.append(os.path.join(GRIT_DIR, 'app_strings_%s.pak' % locale))
46 inputs.append(os.path.join(GRIT_DIR, 'chromecast_settings_%s.pak' % locale)) 46 inputs.append(os.path.join(GRIT_DIR, 'chromecast_settings_%s.pak' % locale))
47 return inputs 47 return inputs
48 48
49 49
50 def list_outputs(locales): 50 def list_outputs(locales):
51 """Returns the names of files that will be generated for the given locales. 51 """Returns the names of files that will be generated for the given locales.
52 52
53 This is to provide gyp the list of output files, so build targets can 53 This is to provide gyp the list of output files, so build targets can
54 properly track what needs to be built. 54 properly track what needs to be built.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 parser = optparse.OptionParser("usage: %prog [options] locales") 92 parser = optparse.OptionParser("usage: %prog [options] locales")
93 parser.add_option("-i", action="store_true", dest="inputs", default=False, 93 parser.add_option("-i", action="store_true", dest="inputs", default=False,
94 help="Print the expected input file list, then exit.") 94 help="Print the expected input file list, then exit.")
95 parser.add_option("-o", action="store_true", dest="outputs", default=False, 95 parser.add_option("-o", action="store_true", dest="outputs", default=False,
96 help="Print the expected output file list, then exit.") 96 help="Print the expected output file list, then exit.")
97 parser.add_option("-g", action="store", dest="grit_dir", 97 parser.add_option("-g", action="store", dest="grit_dir",
98 help="GRIT build files output directory.") 98 help="GRIT build files output directory.")
99 parser.add_option("-x", action="store", dest="int_dir", 99 parser.add_option("-x", action="store", dest="int_dir",
100 help="Intermediate build files output directory.") 100 help="Intermediate build files output directory.")
101 parser.add_option("-b", action="store", dest="chromecast_branding", 101 parser.add_option("-b", action="store", dest="chromecast_branding",
102 help="Chromecast branding " + 102 help="Chromecast branding ('Chrome' or 'Chromium').")
103 "('public', 'internal' or 'google').")
104 options, locales = parser.parse_args(argv) 103 options, locales = parser.parse_args(argv)
105 104
106 if not locales: 105 if not locales:
107 parser.error('Please specificy at least one locale to process.\n') 106 parser.error('Please specificy at least one locale to process.\n')
108 107
109 print_inputs = options.inputs 108 print_inputs = options.inputs
110 print_outputs = options.outputs 109 print_outputs = options.outputs
111 GRIT_DIR = options.grit_dir 110 GRIT_DIR = options.grit_dir
112 INT_DIR = options.int_dir 111 INT_DIR = options.int_dir
113 CHROMECAST_BRANDING = options.chromecast_branding 112 CHROMECAST_BRANDING = options.chromecast_branding
114 113
115 if (CHROMECAST_BRANDING != 'public' and 114 if CHROMECAST_BRANDING != "Chrome" and CHROMECAST_BRANDING != "Chromium":
116 CHROMECAST_BRANDING != 'internal' and 115 parser.error('Chromecast branding (-b) must be "Chrome" or "Chromium".\n')
117 CHROMECAST_BRANDING != 'google'):
118 parser.error('Chromecast branding (-b) must be ' +
119 '"public", "internal" or "google".\n')
120 if not (GRIT_DIR and INT_DIR): 116 if not (GRIT_DIR and INT_DIR):
121 parser.error('Please specify all of "-g" and "-x".\n') 117 parser.error('Please specify all of "-g" and "-x".\n')
122 if print_inputs and print_outputs: 118 if print_inputs and print_outputs:
123 parser.error('Please specify only one of "-i" or "-o".\n') 119 parser.error('Please specify only one of "-i" or "-o".\n')
124 120
125 if print_inputs: 121 if print_inputs:
126 return list_inputs(locales) 122 return list_inputs(locales)
127 123
128 if print_outputs: 124 if print_outputs:
129 return list_outputs(locales) 125 return list_outputs(locales)
130 126
131 return repack_locales(locales) 127 return repack_locales(locales)
132 128
133 if __name__ == '__main__': 129 if __name__ == '__main__':
134 results = DoMain(sys.argv[1:]) 130 results = DoMain(sys.argv[1:])
135 if results: 131 if results:
136 print results 132 print results
OLDNEW
« no previous file with comments | « chromecast/media/media.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698