| 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_listfile <locales-listfile-name>] ' |
| 378 '[--jinja_paths <paths...>] ' | 378 '[--jinja_paths <paths...>] ' |
| 379 '[--service_environment <service_environment>]') | 379 '[--service_environment <service_environment>]') |
| 380 return 1 | 380 return 1 |
| 381 | 381 |
| 382 arg_type = '' | 382 arg_type = '' |
| 383 files = [] | 383 files = [] |
| 384 locales = [] | 384 locales_listfile = '' |
| 385 jinja_paths = [] | 385 jinja_paths = [] |
| 386 app_id = None | 386 app_id = None |
| 387 app_name = None | 387 app_name = None |
| 388 app_description = None | 388 app_description = None |
| 389 app_capabilities = set([]) | 389 app_capabilities = set([]) |
| 390 service_environment = '' | 390 service_environment = '' |
| 391 | 391 |
| 392 for arg in sys.argv[7:]: | 392 for arg in sys.argv[7:]: |
| 393 if arg in ['--locales', | 393 if arg in ['--locales_listfile', |
| 394 '--jinja_paths', | 394 '--jinja_paths', |
| 395 '--appid', | 395 '--appid', |
| 396 '--app_name', | 396 '--app_name', |
| 397 '--app_description', | 397 '--app_description', |
| 398 '--app_capabilities', | 398 '--app_capabilities', |
| 399 '--service_environment']: | 399 '--service_environment']: |
| 400 arg_type = arg | 400 arg_type = arg |
| 401 elif arg_type == '--locales': | 401 elif arg_type == '--locales_listfile': |
| 402 locales.append(arg) | 402 locales_listfile = arg |
| 403 arg_type = '' |
| 403 elif arg_type == '--jinja_paths': | 404 elif arg_type == '--jinja_paths': |
| 404 jinja_paths.append(arg) | 405 jinja_paths.append(arg) |
| 405 elif arg_type == '--appid': | 406 elif arg_type == '--appid': |
| 406 app_id = arg | 407 app_id = arg |
| 407 arg_type = '' | 408 arg_type = '' |
| 408 elif arg_type == '--app_name': | 409 elif arg_type == '--app_name': |
| 409 app_name = arg | 410 app_name = arg |
| 410 arg_type = '' | 411 arg_type = '' |
| 411 elif arg_type == '--app_description': | 412 elif arg_type == '--app_description': |
| 412 app_description = arg | 413 app_description = arg |
| 413 arg_type = '' | 414 arg_type = '' |
| 414 elif arg_type == '--app_capabilities': | 415 elif arg_type == '--app_capabilities': |
| 415 app_capabilities.add(arg) | 416 app_capabilities.add(arg) |
| 416 elif arg_type == '--service_environment': | 417 elif arg_type == '--service_environment': |
| 417 service_environment = arg | 418 service_environment = arg |
| 418 arg_type = '' | 419 arg_type = '' |
| 419 else: | 420 else: |
| 420 files.append(arg) | 421 files.append(arg) |
| 421 | 422 |
| 423 # Load the locales files from the locales_listfile. |
| 424 if not locales_listfile: |
| 425 raise Exception('You must specify a locales_listfile') |
| 426 locales = [] |
| 427 with open(locales_listfile) as input: |
| 428 for s in input: |
| 429 locales.append(s.rstrip()) |
| 430 |
| 422 return buildWebApp(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], | 431 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, | 432 sys.argv[5], sys.argv[6], app_id, app_name, |
| 424 app_description, app_capabilities, files, locales, | 433 app_description, app_capabilities, files, locales, |
| 425 jinja_paths, service_environment) | 434 jinja_paths, service_environment) |
| 426 | 435 |
| 427 | 436 |
| 428 if __name__ == '__main__': | 437 if __name__ == '__main__': |
| 429 sys.exit(main()) | 438 sys.exit(main()) |
| OLD | NEW |