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

Unified Diff: tools/licenses.py

Issue 2802723004: Fix an issue that tools/license.py fails when BUILD.gn is not directly (Closed)
Patch Set: Remove a file included by mistake. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/licenses.py
diff --git a/tools/licenses.py b/tools/licenses.py
index 17dc94a3aab165e29e891a19b42189909aec5750..bdcbca9c7d31d197790843751585ecaf8798539f 100755
--- a/tools/licenses.py
+++ b/tools/licenses.py
@@ -18,6 +18,7 @@ Commands:
import argparse
import cgi
import os
+import re
import subprocess
import sys
@@ -487,9 +488,12 @@ def FindThirdPartyDeps(gn_out_dir, gn_target):
"deps", "--as=buildfile", "--all"])
third_party_deps = set()
for build_dep in gn_deps.split():
- if ("third_party" in build_dep and
- os.path.basename(build_dep) == "BUILD.gn"):
- third_party_deps.add(os.path.dirname(build_dep))
+ # Note that it must always return the direct sub-directory of
+ # third_party. e.g.:
+ # .../third_party/cld_3/src/src/BUILD.gn -> .../third_party/cld_3
+ m = re.search(r"^(.+/third_party/[^/]+)/(.+/)?BUILD\.gn$", build_dep)
Paweł Hajdan Jr. 2017/04/06 11:55:09 nit: Use single quotes ' .
Hiroshi Ichikawa 2017/04/07 05:07:51 Done.
+ if m:
+ third_party_deps.add(m.group(1))
return third_party_deps
« 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