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 """Makes sure that all files contain proper licensing information.""" | 6 """Makes sure that all files contain proper licensing information.""" |
7 | 7 |
8 | 8 |
9 import optparse | 9 import optparse |
10 import os.path | 10 import os.path |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 if matched_prefixes: | 453 if matched_prefixes: |
454 used_suppressions.update(set(matched_prefixes)) | 454 used_suppressions.update(set(matched_prefixes)) |
455 continue | 455 continue |
456 | 456 |
457 print "'%s' has non-whitelisted license '%s'" % (filename, license) | 457 print "'%s' has non-whitelisted license '%s'" % (filename, license) |
458 success = False | 458 success = False |
459 | 459 |
460 if success: | 460 if success: |
461 print "\nSUCCESS\n" | 461 print "\nSUCCESS\n" |
462 | 462 |
463 unused_suppressions = set( | 463 if not len(args): |
464 PATH_SPECIFIC_WHITELISTED_LICENSES.keys()).difference(used_suppressions) | 464 unused_suppressions = set( |
465 if unused_suppressions: | 465 PATH_SPECIFIC_WHITELISTED_LICENSES.keys()).difference(used_suppressions) |
466 print "\nNOTE: unused suppressions detected:\n" | 466 if unused_suppressions: |
467 print '\n'.join(unused_suppressions) | 467 print "\nNOTE: unused suppressions detected:\n" |
| 468 print '\n'.join(unused_suppressions) |
468 | 469 |
469 return 0 | 470 return 0 |
470 else: | 471 else: |
471 print "\nFAILED\n" | 472 print "\nFAILED\n" |
472 print "Please read", | 473 print "Please read", |
473 print "http://www.chromium.org/developers/adding-3rd-party-libraries" | 474 print "http://www.chromium.org/developers/adding-3rd-party-libraries" |
474 print "for more info how to handle the failure." | 475 print "for more info how to handle the failure." |
475 print | 476 print |
476 print "Please respect OWNERS of checklicenses.py. Changes violating" | 477 print "Please respect OWNERS of checklicenses.py. Changes violating" |
477 print "this requirement may be reverted." | 478 print "this requirement may be reverted." |
(...skipping 19 matching lines...) Expand all Loading... |
497 option_parser.add_option('--ignore-suppressions', | 498 option_parser.add_option('--ignore-suppressions', |
498 action='store_true', | 499 action='store_true', |
499 default=False, | 500 default=False, |
500 help='Ignore path-specific license whitelist.') | 501 help='Ignore path-specific license whitelist.') |
501 options, args = option_parser.parse_args() | 502 options, args = option_parser.parse_args() |
502 return check_licenses(options, args) | 503 return check_licenses(options, args) |
503 | 504 |
504 | 505 |
505 if '__main__' == __name__: | 506 if '__main__' == __name__: |
506 sys.exit(main()) | 507 sys.exit(main()) |
OLD | NEW |