Commit e71c95b8 authored by David Landell's avatar David Landell Committed by Commit Bot

Ensure licenses.FindThirdPartyDirs produce consistent paths

The patch set in https://crrev.com/c/2267919 refactored the processing
of additional_readme_paths.json files but introduced the change that
such paths will be absolute instead of relative to the root. Other
paths found by walking the directory tree are relative.

This makes such additional paths relative.

Bug: N/A
Change-Id: Ia2b8cfe99d5e704ed423a17f791aea43a94a8d7f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2379771
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: default avatarJustin DeWitt <dewittj@chromium.org>
Reviewed-by: default avatarBruce Dawson <brucedawson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#802667}
parent 442effe1
...@@ -469,10 +469,10 @@ def FilterDirsWithFiles(dirs_list, root): ...@@ -469,10 +469,10 @@ def FilterDirsWithFiles(dirs_list, root):
return [x for x in dirs_list if ContainsFiles(x, root)] return [x for x in dirs_list if ContainsFiles(x, root)]
def ProcessAdditionalReadmePathsJson(dirname, third_party_dirs): def ProcessAdditionalReadmePathsJson(root, dirname, third_party_dirs):
"""For a given directory, process the additional readme paths, and add to """For a given directory, process the additional readme paths, and add to
third_party_dirs.""" third_party_dirs."""
additional_paths_file = os.path.join(dirname, ADDITIONAL_PATHS_FILENAME) additional_paths_file = os.path.join(root, dirname, ADDITIONAL_PATHS_FILENAME)
if os.path.exists(additional_paths_file): if os.path.exists(additional_paths_file):
with open(additional_paths_file) as paths_file: with open(additional_paths_file) as paths_file:
extra_paths = json.load(paths_file) extra_paths = json.load(paths_file)
...@@ -504,8 +504,7 @@ def FindThirdPartyDirs(prune_paths, root): ...@@ -504,8 +504,7 @@ def FindThirdPartyDirs(prune_paths, root):
if dirpath not in prune_paths: if dirpath not in prune_paths:
third_party_dirs.add(dirpath) third_party_dirs.add(dirpath)
additional_paths_dir = os.path.join(root, dirpath) ProcessAdditionalReadmePathsJson(root, dirpath, third_party_dirs)
ProcessAdditionalReadmePathsJson(additional_paths_dir, third_party_dirs)
# Don't recurse into any subdirs from here. # Don't recurse into any subdirs from here.
dirs[:] = [] dirs[:] = []
...@@ -519,8 +518,7 @@ def FindThirdPartyDirs(prune_paths, root): ...@@ -519,8 +518,7 @@ def FindThirdPartyDirs(prune_paths, root):
for dir in ADDITIONAL_PATHS: for dir in ADDITIONAL_PATHS:
if dir not in prune_paths: if dir not in prune_paths:
third_party_dirs.add(dir) third_party_dirs.add(dir)
additional_paths_dir = os.path.join(root, dir) ProcessAdditionalReadmePathsJson(root, dir, third_party_dirs)
ProcessAdditionalReadmePathsJson(additional_paths_dir, third_party_dirs)
return third_party_dirs return third_party_dirs
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment