Chromium Code Reviews| 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 """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 Loading... | |
| 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 # TODO(phajdan): Consider using PRUNE_PATHS to filter unwanted deps. |
|
Paweł Hajdan Jr.
2017/06/30 07:16:05
Why does this TODO add me? It should add the perso
mef
2017/06/30 12:38:40
I'll be happy to leave it as is or use PRUNE_PATHS
mef
2017/06/30 14:31:45
I've played with relpath and PRUNE_PATHS and it lo
| |
| 497 if m and not os.path.join("secondary", "third_party") in build_dep: | |
| 497 third_party_deps.add(m.group(1)) | 498 third_party_deps.add(m.group(1)) |
| 498 return third_party_deps | 499 return third_party_deps |
| 499 | 500 |
| 500 | 501 |
| 501 def FindThirdPartyDeps(gn_out_dir, gn_target): | 502 def FindThirdPartyDeps(gn_out_dir, gn_target): |
| 502 if not gn_out_dir: | 503 if not gn_out_dir: |
| 503 raise RuntimeError("--gn-out-dir is required if --gn-target is used.") | 504 raise RuntimeError("--gn-out-dir is required if --gn-target is used.") |
| 504 | 505 |
| 505 # Generate gn project in temp directory and use it to find dependencies. | 506 # 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 | 507 # 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 Loading... | |
| 732 if not GenerateLicenseFile( | 733 if not GenerateLicenseFile( |
| 733 args.output_file, args.gn_out_dir, args.gn_target): | 734 args.output_file, args.gn_out_dir, args.gn_target): |
| 734 return 1 | 735 return 1 |
| 735 else: | 736 else: |
| 736 print __doc__ | 737 print __doc__ |
| 737 return 1 | 738 return 1 |
| 738 | 739 |
| 739 | 740 |
| 740 if __name__ == '__main__': | 741 if __name__ == '__main__': |
| 741 sys.exit(main()) | 742 sys.exit(main()) |
| OLD | NEW |