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

Side by Side Diff: tools/licenses.py

Issue 2802863004: Improve error message of //tools/licenses.py. (Closed)
Patch Set: Created 3 years, 8 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 """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
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
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())
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