OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 ], | 125 ], |
126 'ppapi/c/documentation/check.sh': [ | 126 'ppapi/c/documentation/check.sh': [ |
127 'UNKNOWN', | 127 'UNKNOWN', |
128 ], | 128 ], |
129 'ppapi/cpp/documentation/check.sh': [ | 129 'ppapi/cpp/documentation/check.sh': [ |
130 'UNKNOWN', | 130 'UNKNOWN', |
131 ], | 131 ], |
132 'ppapi/lib/gl/include': [ | 132 'ppapi/lib/gl/include': [ |
133 'UNKNOWN', | 133 'UNKNOWN', |
134 ], | 134 ], |
| 135 'ppapi/native_client/tests/earth/earth_image.inc': [ |
| 136 'UNKNOWN', |
| 137 ], |
135 'remoting/tools/gethosts.sh': [ | 138 'remoting/tools/gethosts.sh': [ |
136 'UNKNOWN', | 139 'UNKNOWN', |
137 ], | 140 ], |
138 'sdch/open-vcdiff': [ | 141 'sdch/open-vcdiff': [ |
139 'UNKNOWN', | 142 'UNKNOWN', |
140 ], | 143 ], |
141 'third_party/WebKit': [ | 144 'third_party/WebKit': [ |
142 'UNKNOWN', | 145 'UNKNOWN', |
143 ], | 146 ], |
144 'third_party/WebKit/Source/ThirdParty/ANGLE/src/compiler': [ | 147 'third_party/WebKit/Source/ThirdParty/ANGLE/src/compiler': [ |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 # Directory specified. Start here. It's supposed to be relative to the | 412 # Directory specified. Start here. It's supposed to be relative to the |
410 # base directory. | 413 # base directory. |
411 start_dir = os.path.abspath(os.path.join(options.base_directory, args[0])) | 414 start_dir = os.path.abspath(os.path.join(options.base_directory, args[0])) |
412 else: | 415 else: |
413 # More than one argument, we don't handle this. | 416 # More than one argument, we don't handle this. |
414 PrintUsage() | 417 PrintUsage() |
415 sys.exit(1) | 418 sys.exit(1) |
416 | 419 |
417 print "Using base directory:", options.base_directory | 420 print "Using base directory:", options.base_directory |
418 print "Checking:", start_dir | 421 print "Checking:", start_dir |
| 422 print |
419 | 423 |
420 licensecheck_path = os.path.abspath(os.path.join(options.base_directory, | 424 licensecheck_path = os.path.abspath(os.path.join(options.base_directory, |
421 'third_party', | 425 'third_party', |
422 'devscripts', | 426 'devscripts', |
423 'licensecheck.pl')) | 427 'licensecheck.pl')) |
424 | 428 |
425 licensecheck = subprocess.Popen([licensecheck_path, '-r', start_dir], | 429 licensecheck = subprocess.Popen([licensecheck_path, '-r', start_dir], |
426 stdout=subprocess.PIPE, | 430 stdout=subprocess.PIPE, |
427 stderr=subprocess.PIPE) | 431 stderr=subprocess.PIPE) |
428 stdout, stderr = licensecheck.communicate() | 432 stdout, stderr = licensecheck.communicate() |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 continue | 471 continue |
468 | 472 |
469 print "'%s' has non-whitelisted license '%s'" % (filename, license) | 473 print "'%s' has non-whitelisted license '%s'" % (filename, license) |
470 success = False | 474 success = False |
471 | 475 |
472 if success: | 476 if success: |
473 print "\nSUCCESS\n" | 477 print "\nSUCCESS\n" |
474 sys.exit(0) | 478 sys.exit(0) |
475 else: | 479 else: |
476 print "\nFAILED\n" | 480 print "\nFAILED\n" |
477 sys.exit(1) | 481 print "Please read", |
| 482 print "http://www.chromium.org/developers/adding-3rd-party-libraries" |
| 483 print "for more info how to handle the failure." |
| 484 print |
| 485 print "Please respect OWNERS of checklicenses.py. Changes violating" |
| 486 print "this requirement may be reverted." |
| 487 |
| 488 # TODO(phajdan.jr): Switch back to exit(1) when it lands on buildbot. |
| 489 # 88 is buildbot "warning" code, it doesn't turn the step red but orange. |
| 490 sys.exit(88) |
478 | 491 |
479 | 492 |
480 if '__main__' == __name__: | 493 if '__main__' == __name__: |
481 default_root = os.path.abspath( | 494 default_root = os.path.abspath( |
482 os.path.join(os.path.dirname(__file__), '..', '..')) | 495 os.path.join(os.path.dirname(__file__), '..', '..')) |
483 option_parser = optparse.OptionParser() | 496 option_parser = optparse.OptionParser() |
484 option_parser.add_option('--root', default=default_root, | 497 option_parser.add_option('--root', default=default_root, |
485 dest='base_directory', | 498 dest='base_directory', |
486 help='Specifies the repository root. This defaults ' | 499 help='Specifies the repository root. This defaults ' |
487 'to "../.." relative to the script file, which ' | 500 'to "../.." relative to the script file, which ' |
488 'will normally be the repository root.') | 501 'will normally be the repository root.') |
489 option_parser.add_option('-v', '--verbose', action='store_true', | 502 option_parser.add_option('-v', '--verbose', action='store_true', |
490 default=False, help='Print debug logging') | 503 default=False, help='Print debug logging') |
491 options, args = option_parser.parse_args() | 504 options, args = option_parser.parse_args() |
492 main(options, args) | 505 main(options, args) |
OLD | NEW |