OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """Creates a directory with with the unpacked contents of the remoting webapp. | 6 """Creates a directory with with the unpacked contents of the remoting webapp. |
7 | 7 |
8 The directory will contain a copy-of or a link-to to all remoting webapp | 8 The directory will contain a copy-of or a link-to to all remoting webapp |
9 resources. This includes HTML/JS and any plugin binaries. The script also | 9 resources. This includes HTML/JS and any plugin binaries. The script also |
10 massages resulting files appropriately with host plugin data. Finally, | 10 massages resulting files appropriately with host plugin data. Finally, |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
367 | 367 |
368 def main(): | 368 def main(): |
369 if len(sys.argv) < 6: | 369 if len(sys.argv) < 6: |
370 print ('Usage: build-webapp.py ' | 370 print ('Usage: build-webapp.py ' |
371 '<build-type> <version> <dst> <zip-path> <manifest_template> ' | 371 '<build-type> <version> <dst> <zip-path> <manifest_template> ' |
372 '<webapp_type> <other files...> ' | 372 '<webapp_type> <other files...> ' |
373 '--app_name <name> ' | 373 '--app_name <name> ' |
374 '--app_description <description> ' | 374 '--app_description <description> ' |
375 '--app_capabilities <capabilities...> ' | 375 '--app_capabilities <capabilities...> ' |
376 '[--appid <appid>] ' | 376 '[--appid <appid>] ' |
377 '[--locales <locales...>] ' | 377 '[--locales <locales...>] ' |
Jamie
2015/02/05 19:26:20
Do we still need to support --locales? If not then
garykac
2015/02/06 02:13:35
Done.
| |
378 '[--locale_file <locale-file>] ' | |
Jamie
2015/02/05 19:26:20
s/locale/locales/g (it contains a list of all loca
garykac
2015/02/06 02:13:35
Done.
| |
378 '[--jinja_paths <paths...>] ' | 379 '[--jinja_paths <paths...>] ' |
379 '[--service_environment <service_environment>]') | 380 '[--service_environment <service_environment>]') |
380 return 1 | 381 return 1 |
381 | 382 |
382 arg_type = '' | 383 arg_type = '' |
383 files = [] | 384 files = [] |
384 locales = [] | 385 locales = [] |
386 locale_file = '' | |
385 jinja_paths = [] | 387 jinja_paths = [] |
386 app_id = None | 388 app_id = None |
387 app_name = None | 389 app_name = None |
388 app_description = None | 390 app_description = None |
389 app_capabilities = set([]) | 391 app_capabilities = set([]) |
390 service_environment = '' | 392 service_environment = '' |
391 | 393 |
392 for arg in sys.argv[7:]: | 394 for arg in sys.argv[7:]: |
393 if arg in ['--locales', | 395 if arg in ['--locales', |
396 '--locale_file', | |
394 '--jinja_paths', | 397 '--jinja_paths', |
395 '--appid', | 398 '--appid', |
396 '--app_name', | 399 '--app_name', |
397 '--app_description', | 400 '--app_description', |
398 '--app_capabilities', | 401 '--app_capabilities', |
399 '--service_environment']: | 402 '--service_environment']: |
400 arg_type = arg | 403 arg_type = arg |
401 elif arg_type == '--locales': | 404 elif arg_type == '--locales': |
402 locales.append(arg) | 405 locales.append(arg) |
406 elif arg_type == '--locale_file': | |
407 locale_file = arg | |
408 arg_type = '' | |
403 elif arg_type == '--jinja_paths': | 409 elif arg_type == '--jinja_paths': |
404 jinja_paths.append(arg) | 410 jinja_paths.append(arg) |
405 elif arg_type == '--appid': | 411 elif arg_type == '--appid': |
406 app_id = arg | 412 app_id = arg |
407 arg_type = '' | 413 arg_type = '' |
408 elif arg_type == '--app_name': | 414 elif arg_type == '--app_name': |
409 app_name = arg | 415 app_name = arg |
410 arg_type = '' | 416 arg_type = '' |
411 elif arg_type == '--app_description': | 417 elif arg_type == '--app_description': |
412 app_description = arg | 418 app_description = arg |
413 arg_type = '' | 419 arg_type = '' |
414 elif arg_type == '--app_capabilities': | 420 elif arg_type == '--app_capabilities': |
415 app_capabilities.add(arg) | 421 app_capabilities.add(arg) |
416 elif arg_type == '--service_environment': | 422 elif arg_type == '--service_environment': |
417 service_environment = arg | 423 service_environment = arg |
418 arg_type = '' | 424 arg_type = '' |
419 else: | 425 else: |
420 files.append(arg) | 426 files.append(arg) |
421 | 427 |
428 # If the locale files were specified in a listfile, then load them into | |
429 # the locales array. | |
430 if locale_file: | |
431 with open(locale_file) as input: | |
432 for s in input: | |
433 locales.append(s.rstrip()) | |
434 | |
422 return buildWebApp(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], | 435 return buildWebApp(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], |
423 sys.argv[5], sys.argv[6], app_id, app_name, | 436 sys.argv[5], sys.argv[6], app_id, app_name, |
424 app_description, app_capabilities, files, locales, | 437 app_description, app_capabilities, files, locales, |
425 jinja_paths, service_environment) | 438 jinja_paths, service_environment) |
426 | 439 |
427 | 440 |
428 if __name__ == '__main__': | 441 if __name__ == '__main__': |
429 sys.exit(main()) | 442 sys.exit(main()) |
OLD | NEW |