| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 """Generates the contents of an Cronet LICENSE file for the third-party code. | 6 """Generates the contents of an Cronet LICENSE file for the third-party code. |
| 7 | 7 |
| 8 It makes use of src/tools/licenses.py and the README.chromium files on which | 8 It makes use of src/tools/licenses.py and the README.chromium files on which |
| 9 it depends. Based on android_webview/tools/webview_licenses.py. | 9 it depends. Based on android_webview/tools/webview_licenses.py. |
| 10 """ | 10 """ |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 usage='%prog command [options]') | 97 usage='%prog command [options]') |
| 98 parser.add_option('--gn', help='Use gn deps to find third party dependencies', | 98 parser.add_option('--gn', help='Use gn deps to find third party dependencies', |
| 99 action='store_true') | 99 action='store_true') |
| 100 parser.add_option('--gn-path', default='gn', | 100 parser.add_option('--gn-path', default='gn', |
| 101 help='Path to gn executable (default: %(default)s)') | 101 help='Path to gn executable (default: %(default)s)') |
| 102 parser.description = (__doc__ + | 102 parser.description = (__doc__ + |
| 103 '\nCommands:\n' \ | 103 '\nCommands:\n' \ |
| 104 ' license [filename]\n' \ | 104 ' license [filename]\n' \ |
| 105 ' Generate Cronet LICENSE to filename or stdout.\n') | 105 ' Generate Cronet LICENSE to filename or stdout.\n') |
| 106 (flags, args) = parser.parse_args() | 106 (flags, args) = parser.parse_args() |
| 107 print flags | |
| 108 | 107 |
| 109 if flags.gn: | 108 if flags.gn: |
| 110 global third_party_dirs | 109 global third_party_dirs |
| 111 third_party_dirs = FindThirdPartyDeps(flags.gn_path, os.getcwd()) | 110 third_party_dirs = FindThirdPartyDeps(flags.gn_path, os.getcwd()) |
| 112 | 111 |
| 113 if not args: | 112 if not args: |
| 114 parser.print_help() | 113 parser.print_help() |
| 115 return 1 | 114 return 1 |
| 116 | 115 |
| 117 if args[0] == 'license': | 116 if args[0] == 'license': |
| 118 if len(args) > 1: | 117 if len(args) > 1: |
| 119 f = open(args[1], "w") | 118 f = open(args[1], "w") |
| 120 try: | 119 try: |
| 121 f.write(GenerateLicense()) | 120 f.write(GenerateLicense()) |
| 122 finally: | 121 finally: |
| 123 f.close() | 122 f.close() |
| 124 else: | 123 else: |
| 125 print GenerateLicense() | 124 print GenerateLicense() |
| 126 return 0 | 125 return 0 |
| 127 | 126 |
| 128 parser.print_help() | 127 parser.print_help() |
| 129 return 1 | 128 return 1 |
| 130 | 129 |
| 131 | 130 |
| 132 if __name__ == '__main__': | 131 if __name__ == '__main__': |
| 133 sys.exit(main()) | 132 sys.exit(main()) |
| OLD | NEW |