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

Side by Side Diff: src/caterpillar.py

Issue 1665103002: Removed replacing double- with single-quotes in app.info generation. Resolves #40. (Closed) Base URL: https://github.com/chromium/caterpillar.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | src/caterpillar_test.py » ('j') | src/caterpillar_test.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python2 1 #!/usr/bin/env python2
2 # -*- coding: utf-8 -*- 2 # -*- coding: utf-8 -*-
3 3
4 # Copyright 2015 Google Inc. All Rights Reserved. 4 # Copyright 2015 Google Inc. All Rights Reserved.
5 # 5 #
6 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License. 7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at 8 # You may obtain a copy of the License at
9 # 9 #
10 # http://www.apache.org/licenses/LICENSE-2.0 10 # http://www.apache.org/licenses/LICENSE-2.0
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 455
456 def add_app_info(output_dir, chrome_app_manifest): 456 def add_app_info(output_dir, chrome_app_manifest):
457 """Adds an app info script, containing metadata, to a web app. 457 """Adds an app info script, containing metadata, to a web app.
458 458
459 Args: 459 Args:
460 output_dir: Path to web app to add app info script to. 460 output_dir: Path to web app to add app info script to.
461 chrome_app_manifest: Chrome App manifest dictionary. 461 chrome_app_manifest: Chrome App manifest dictionary.
462 """ 462 """
463 logging.debug('Generating app info script.') 463 logging.debug('Generating app info script.')
464 js_manifest = json.dumps(chrome_app_manifest, sort_keys=True, indent=2, 464 js_manifest = json.dumps(chrome_app_manifest, sort_keys=True, indent=2,
465 separators=(',', ': ')).replace('"', "'") 465 separators=(',', ': '))
466 app_info_js = ('chrome.caterpillar.manifest = {manifest};\n').format( 466 app_info_js = ('chrome.caterpillar.manifest = {manifest};\n').format(
467 manifest=js_manifest) 467 manifest=js_manifest)
468 app_info_path = os.path.join(output_dir, INFO_SCRIPT_NAME) 468 app_info_path = os.path.join(output_dir, INFO_SCRIPT_NAME)
469 logging.debug('Writing app info script to `%s`.', app_info_path) 469 logging.debug('Writing app info script to `%s`.', app_info_path)
470 with open(app_info_path, 'w') as app_info_file: 470 with open(app_info_path, 'w') as app_info_file:
471 app_info_file.write(app_info_js.encode('utf-8')) 471 app_info_file.write(app_info_js.encode('utf-8'))
472 472
473 473
474 class InstallationError(Exception): 474 class InstallationError(Exception):
475 """Exception raised when a dependency fails to install.""" 475 """Exception raised when a dependency fails to install."""
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 configuration.generate_and_save(args.output, args.interactive) 854 configuration.generate_and_save(args.output, args.interactive)
855 855
856 elif args.mode == 'convert': 856 elif args.mode == 'convert':
857 config = configuration.load(args.config) 857 config = configuration.load(args.config)
858 convert_app(args.input, args.output, config, handler.captured_warnings, 858 convert_app(args.input, args.output, config, handler.captured_warnings,
859 args.force) 859 args.force)
860 860
861 861
862 if __name__ == '__main__': 862 if __name__ == '__main__':
863 sys.exit(main()) 863 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | src/caterpillar_test.py » ('j') | src/caterpillar_test.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698