| 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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 continue | 432 continue |
| 433 env = { | 433 env = { |
| 434 'name': metadata['Name'], | 434 'name': metadata['Name'], |
| 435 'url': metadata['URL'], | 435 'url': metadata['URL'], |
| 436 'license': open(metadata['License File'], 'rb').read(), | 436 'license': open(metadata['License File'], 'rb').read(), |
| 437 } | 437 } |
| 438 entries.append(EvaluateTemplate(entry_template, env)) | 438 entries.append(EvaluateTemplate(entry_template, env)) |
| 439 | 439 |
| 440 file_template = open(os.path.join(templates_dir, | 440 file_template = open(os.path.join(templates_dir, |
| 441 'about_credits.tmpl'), 'rb').read() | 441 'about_credits.tmpl'), 'rb').read() |
| 442 template_contents = "<!-- Generated by licenses.py; do not edit. -->" | |
| 443 template_contents += EvaluateTemplate(file_template, | 442 template_contents += EvaluateTemplate(file_template, |
| 444 {'entries': '\n'.join(entries)}, | 443 {'entries': '\n'.join(entries)}, |
| 445 escape=False) | 444 escape=False) |
| 446 | 445 |
| 447 if len(sys.argv) == 3: | 446 if len(sys.argv) == 3: |
| 448 with open(sys.argv[2], 'w') as output_file: | 447 with open(sys.argv[2], 'w') as output_file: |
| 449 output_file.write(template_contents) | 448 output_file.write(template_contents) |
| 450 elif len(sys.argv) == 2: | 449 elif len(sys.argv) == 2: |
| 451 print template_contents | 450 print template_contents |
| 452 | 451 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 464 elif command == 'credits': | 463 elif command == 'credits': |
| 465 if not GenerateCredits(): | 464 if not GenerateCredits(): |
| 466 return 1 | 465 return 1 |
| 467 else: | 466 else: |
| 468 print __doc__ | 467 print __doc__ |
| 469 return 1 | 468 return 1 |
| 470 | 469 |
| 471 | 470 |
| 472 if __name__ == '__main__': | 471 if __name__ == '__main__': |
| 473 sys.exit(main()) | 472 sys.exit(main()) |
| OLD | NEW |