Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: tools/checklicenses/checklicenses.py

Issue 1329243002: Excluded sysroot directories from checklicences.py (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a excluded path list. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 json 9 import json
10 import optparse 10 import optparse
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 'UNKNOWN', 541 'UNKNOWN',
542 ], 542 ],
543 'v8/test/cctest': [ # http://crbug.com/98597 543 'v8/test/cctest': [ # http://crbug.com/98597
544 'UNKNOWN', 544 'UNKNOWN',
545 ], 545 ],
546 'v8/src/third_party/kernel/tools/perf/util/jitdump.h': [ # http://crbug.com /391716 546 'v8/src/third_party/kernel/tools/perf/util/jitdump.h': [ # http://crbug.com /391716
547 'UNKNOWN', 547 'UNKNOWN',
548 ], 548 ],
549 } 549 }
550 550
551 EXCLUDED_PATHS = [
552 # Don't check generated files
553 'out/',
554
555 # Don't check sysroot directories
556 'build/linux/debian_wheezy_amd64-sysroot',
557 'build/linux/debian_wheezy_arm-sysroot',
558 'build/linux/debian_wheezy_i386-sysroot',
559 'build/linux/debian_wheezy_mips-sysroot',
560 ]
561
551 562
552 def check_licenses(options, args): 563 def check_licenses(options, args):
553 # Figure out which directory we have to check. 564 # Figure out which directory we have to check.
554 if len(args) == 0: 565 if len(args) == 0:
555 # No directory to check specified, use the repository root. 566 # No directory to check specified, use the repository root.
556 start_dir = options.base_directory 567 start_dir = options.base_directory
557 elif len(args) == 1: 568 elif len(args) == 1:
558 # Directory specified. Start here. It's supposed to be relative to the 569 # Directory specified. Start here. It's supposed to be relative to the
559 # base directory. 570 # base directory.
560 start_dir = os.path.abspath(os.path.join(options.base_directory, args[0])) 571 start_dir = os.path.abspath(os.path.join(options.base_directory, args[0]))
(...skipping 28 matching lines...) Expand all
589 print "\nFAILED\n" 600 print "\nFAILED\n"
590 return 1 601 return 1
591 602
592 used_suppressions = set() 603 used_suppressions = set()
593 errors = [] 604 errors = []
594 605
595 for line in stdout.splitlines(): 606 for line in stdout.splitlines():
596 filename, license = line.split(':', 1) 607 filename, license = line.split(':', 1)
597 filename = os.path.relpath(filename.strip(), options.base_directory) 608 filename = os.path.relpath(filename.strip(), options.base_directory)
598 609
599 # All files in the build output directory are generated one way or another. 610 # Check if the file belongs to one of the excluded paths.
600 # There's no need to check them. 611 if any((filename.startswith(path) for path in EXCLUDED_PATHS)):
601 if filename.startswith('out/'):
602 continue 612 continue
603 613
604 # For now we're just interested in the license. 614 # For now we're just interested in the license.
605 license = license.replace('*No copyright*', '').strip() 615 license = license.replace('*No copyright*', '').strip()
606 616
607 # Skip generated files. 617 # Skip generated files.
608 if 'GENERATED FILE' in license: 618 if 'GENERATED FILE' in license:
609 continue 619 continue
610 620
611 if license in WHITELISTED_LICENSES: 621 if license in WHITELISTED_LICENSES:
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 action='store_true', 682 action='store_true',
673 default=False, 683 default=False,
674 help='Ignore path-specific license whitelist.') 684 help='Ignore path-specific license whitelist.')
675 option_parser.add_option('--json', help='Path to JSON output file') 685 option_parser.add_option('--json', help='Path to JSON output file')
676 options, args = option_parser.parse_args() 686 options, args = option_parser.parse_args()
677 return check_licenses(options, args) 687 return check_licenses(options, args)
678 688
679 689
680 if '__main__' == __name__: 690 if '__main__' == __name__:
681 sys.exit(main()) 691 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698