Lines Matching +full:- +full:- +full:build +full:- +full:options
3 # Use of this source code is governed by a BSD-style license that can be
7 version.py -- Chromium version string substitution utility.
129 """Build argparse parser, with added arguments."""
131 parser.add_argument('-f', '--file', action='append', default=[],
133 parser.add_argument('-i', '--input', default=None,
135 parser.add_argument('-o', '--output', default=None,
137 parser.add_argument('-t', '--template', default=None,
139 parser.add_argument('-x',
140 '--executable',
145 '-e',
146 '--eval',
150 'to synthesize variables. e.g. -e \'PATCH_HI=int('
153 '-a',
154 '--arch',
157 help='Set which cpu architecture the build is for.')
158 parser.add_argument('--os', default=None, help='Set the target os.')
159 parser.add_argument('--official', action='store_true',
160 help='Whether the current build should be an official '
161 'build, used in addition to the environment '
169 def BuildEvals(options, parser): argument
170 """Construct a dict of passed '-e' arguments for evaluating."""
172 for expression in options.eval:
176 parser.error('-e requires VAR=VAL')
180 def ModifyOptionsCompat(options, parser): argument
184 positional arguments shorthands for --input and --output.
186 while len(options.args) and (options.input is None or options.output is None):
187 if options.input is None:
188 options.input = options.args.pop(0)
189 elif options.output is None:
190 options.output = options.args.pop(0)
191 if options.args:
192 parser.error('Unexpected arguments: %r' % options.args)
195 def GenerateValues(options, evals): argument
200 'BUILD': 74,
204 'build = "@BUILD@"' into 'build = "74"'
207 values = FetchValues(options.file, options.official)
212 if options.os == 'android':
214 int(values['BUILD']), int(values['PATCH']), options.arch)
220 def GenerateOutputContents(options, values): argument
224 options -- argparse parsed arguments
225 values -- dict with raw values used to resolve the keywords in a template
229 if options.template is not None:
230 return SubstTemplate(options.template, values)
231 elif options.input:
232 return SubstFile(options.input, values)
237 BUILD=%(BUILD)s
244 def GenerateOutputMode(options): argument
248 options -- argparse parsed arguments
250 if options.executable:
258 # Build argparse parser with arguments
260 options = parser.parse_args(args)
262 # Get dict of passed '-e' arguments for evaluating
263 evals = BuildEvals(options, parser)
265 # arguments shorthands for --input and --output.
266 ModifyOptionsCompat(options, parser)
269 values = GenerateValues(options, evals)
271 contents = GenerateOutputContents(options, values)
272 mode = GenerateOutputMode(options)
274 return {'options': options, 'contents': contents, 'mode': mode}
280 if output['options'].output is not None:
281 WriteIfChanged(output['options'].output, output['contents'], output['mode'])