| Index: mojo/devtools/common/devtoolslib/paths.py
|
| diff --git a/mojo/devtools/common/devtoolslib/paths.py b/mojo/devtools/common/devtoolslib/paths.py
|
| index 1b0bff4720377f99d12cccff02a14a385d13f090..502636a06d7681b0ddc2c59110e80474178da6ad 100644
|
| --- a/mojo/devtools/common/devtoolslib/paths.py
|
| +++ b/mojo/devtools/common/devtoolslib/paths.py
|
| @@ -13,9 +13,9 @@ import os.path
|
| import sys
|
|
|
|
|
| -def find_ancestor_with(relpath):
|
| +def find_ancestor_with(relpath, start_path=None):
|
| """Returns the lowest ancestor of this file that contains |relpath|."""
|
| - cur_dir_path = os.path.abspath(os.path.dirname(__file__))
|
| + cur_dir_path = start_path or os.path.abspath(os.path.dirname(__file__))
|
| while True:
|
| if os.path.exists(os.path.join(cur_dir_path, relpath)):
|
| return cur_dir_path
|
| @@ -27,6 +27,16 @@ def find_ancestor_with(relpath):
|
| return None
|
|
|
|
|
| +def find_within_ancestors(target_relpath, start_path=None):
|
| + """Returns the absolute path to |target_relpath| in the lowest ancestor of
|
| + |start_path| that contains it.
|
| + """
|
| + ancestor = find_ancestor_with(target_relpath, start_path)
|
| + if not ancestor:
|
| + return None
|
| + return os.path.join(ancestor, target_relpath)
|
| +
|
| +
|
| def infer_paths(is_android, is_debug, target_cpu):
|
| """Infers the locations of select build output artifacts in a regular
|
| Chromium-like checkout. This should grow thinner or disappear as we introduce
|
|
|