| 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 """Utility for checking and processing licensing information in third_party | 6 """Utility for checking and processing licensing information in third_party |
| 7 directories. | 7 directories. |
| 8 | 8 |
| 9 Usage: licenses.py <command> | 9 Usage: licenses.py <command> |
| 10 | 10 |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 if optional_keys is None: | 351 if optional_keys is None: |
| 352 optional_keys = [] | 352 optional_keys = [] |
| 353 | 353 |
| 354 if path in SPECIAL_CASES: | 354 if path in SPECIAL_CASES: |
| 355 metadata.update(SPECIAL_CASES[path]) | 355 metadata.update(SPECIAL_CASES[path]) |
| 356 else: | 356 else: |
| 357 # Try to find README.chromium. | 357 # Try to find README.chromium. |
| 358 readme_path = os.path.join(root, path, 'README.chromium') | 358 readme_path = os.path.join(root, path, 'README.chromium') |
| 359 if not os.path.exists(readme_path): | 359 if not os.path.exists(readme_path): |
| 360 raise LicenseError("missing README.chromium or licenses.py " | 360 raise LicenseError("missing README.chromium or licenses.py " |
| 361 "SPECIAL_CASES entry") | 361 "SPECIAL_CASES entry in %s" % path) |
| 362 | 362 |
| 363 for line in open(readme_path): | 363 for line in open(readme_path): |
| 364 line = line.strip() | 364 line = line.strip() |
| 365 if not line: | 365 if not line: |
| 366 break | 366 break |
| 367 for key in metadata.keys() + optional_keys: | 367 for key in metadata.keys() + optional_keys: |
| 368 field = key + ": " | 368 field = key + ": " |
| 369 if line.startswith(field): | 369 if line.startswith(field): |
| 370 metadata[key] = line[len(field):] | 370 metadata[key] = line[len(field):] |
| 371 | 371 |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 args.output_file, args.target_os, | 631 args.output_file, args.target_os, |
| 632 args.gn_out_dir, args.gn_target, args.depfile): | 632 args.gn_out_dir, args.gn_target, args.depfile): |
| 633 return 1 | 633 return 1 |
| 634 else: | 634 else: |
| 635 print __doc__ | 635 print __doc__ |
| 636 return 1 | 636 return 1 |
| 637 | 637 |
| 638 | 638 |
| 639 if __name__ == '__main__': | 639 if __name__ == '__main__': |
| 640 sys.exit(main()) | 640 sys.exit(main()) |
| OLD | NEW |