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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 # would satisfy the compiler but might confused human readers. | 69 # would satisfy the compiler but might confused human readers. |
70 findAndReplace(os.path.join(destination, 'plugin_settings.js'), | 70 findAndReplace(os.path.join(destination, 'plugin_settings.js'), |
71 "!!'" + placeholder + "'", 'true' if value else 'false') | 71 "!!'" + placeholder + "'", 'true' if value else 'false') |
72 | 72 |
73 | 73 |
74 def parseBool(boolStr): | 74 def parseBool(boolStr): |
75 """Tries to parse a string as a boolean value. | 75 """Tries to parse a string as a boolean value. |
76 | 76 |
77 Returns a bool on success; raises ValueError on failure. | 77 Returns a bool on success; raises ValueError on failure. |
78 """ | 78 """ |
79 lower = boolStr.tolower() | 79 lower = boolStr.lower() |
80 if lower in ['0', 'false']: return False | 80 if lower in ['0', 'false']: return False |
81 if lower in ['1', 'true']: return True | 81 if lower in ['1', 'true']: return True |
82 raise ValueError('not a boolean string {!r}'.format(boolStr)) | 82 raise ValueError('not a boolean string {!r}'.format(boolStr)) |
83 | 83 |
84 | 84 |
85 def getenvBool(name, defaultValue): | 85 def getenvBool(name, defaultValue): |
86 """Gets an environment value as a boolean.""" | 86 """Gets an environment value as a boolean.""" |
87 rawValue = os.environ.get(name) | 87 rawValue = os.environ.get(name) |
88 if rawValue is None: | 88 if rawValue is None: |
89 return defaultValue | 89 return defaultValue |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 parser.add_argument('--use_gcd', choices=['0', '1'], default='0') | 458 parser.add_argument('--use_gcd', choices=['0', '1'], default='0') |
459 | 459 |
460 args = parser.parse_args() | 460 args = parser.parse_args() |
461 args.use_gcd = (args.use_gcd != '0') | 461 args.use_gcd = (args.use_gcd != '0') |
462 args.app_capabilities = set(args.app_capabilities) | 462 args.app_capabilities = set(args.app_capabilities) |
463 return buildWebApp(**vars(args)) | 463 return buildWebApp(**vars(args)) |
464 | 464 |
465 | 465 |
466 if __name__ == '__main__': | 466 if __name__ == '__main__': |
467 sys.exit(main()) | 467 sys.exit(main()) |
OLD | NEW |