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

Side by Side Diff: tools/licenses.py

Issue 2959303002: [Cronet] Use gn desc to find third party licenses on Android. (Closed)
Patch Set: Use single quotes. Created 3 years, 5 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 | « components/cronet/android/BUILD.gn ('k') | 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 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 """Returns third_party/foo directories given the output of "gn desc deps". 486 """Returns third_party/foo directories given the output of "gn desc deps".
487 487
488 Note that it always returns the direct sub-directory of third_party 488 Note that it always returns the direct sub-directory of third_party
489 where README.chromium and LICENSE files are, so that it can be passed to 489 where README.chromium and LICENSE files are, so that it can be passed to
490 ParseDir(). e.g.: 490 ParseDir(). e.g.:
491 .../third_party/cld_3/src/src/BUILD.gn -> .../third_party/cld_3 491 .../third_party/cld_3/src/src/BUILD.gn -> .../third_party/cld_3
492 """ 492 """
493 third_party_deps = set() 493 third_party_deps = set()
494 for build_dep in gn_deps.split(): 494 for build_dep in gn_deps.split():
495 m = re.search(r'^(.+/third_party/[^/]+)/(.+/)?BUILD\.gn$', build_dep) 495 m = re.search(r'^(.+/third_party/[^/]+)/(.+/)?BUILD\.gn$', build_dep)
496 if m: 496 if m and not os.path.join('build', 'secondary') in build_dep:
497 third_party_deps.add(m.group(1)) 497 third_party_deps.add(m.group(1))
498 return third_party_deps 498 return third_party_deps
499 499
500 500
501 def FindThirdPartyDeps(gn_out_dir, gn_target): 501 def FindThirdPartyDeps(gn_out_dir, gn_target):
502 if not gn_out_dir: 502 if not gn_out_dir:
503 raise RuntimeError("--gn-out-dir is required if --gn-target is used.") 503 raise RuntimeError("--gn-out-dir is required if --gn-target is used.")
504 504
505 # Generate gn project in temp directory and use it to find dependencies. 505 # Generate gn project in temp directory and use it to find dependencies.
506 # Current gn directory cannot be used when we run this script in a gn action 506 # Current gn directory cannot be used when we run this script in a gn action
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 if not GenerateLicenseFile( 732 if not GenerateLicenseFile(
733 args.output_file, args.gn_out_dir, args.gn_target): 733 args.output_file, args.gn_out_dir, args.gn_target):
734 return 1 734 return 1
735 else: 735 else:
736 print __doc__ 736 print __doc__
737 return 1 737 return 1
738 738
739 739
740 if __name__ == '__main__': 740 if __name__ == '__main__':
741 sys.exit(main()) 741 sys.exit(main())
OLDNEW
« no previous file with comments | « components/cronet/android/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698