diff options
author | Jonathan Maw <jonathan.maw@codethink.co.uk> | 2018-10-31 13:57:13 +0000 |
---|---|---|
committer | Jonathan Maw <jonathan.maw@codethink.co.uk> | 2018-12-11 12:56:32 +0000 |
commit | 7deeb2c3cada7b3e779f69c5fd27069e2236f7ab (patch) | |
tree | 1e14f0b41625c88e7bdbcf340600ad5903b5a773 /buildstream | |
parent | 64836b18c9f72889d94d2fb01fda4ecc80d0816e (diff) | |
download | buildstream-7deeb2c3cada7b3e779f69c5fd27069e2236f7ab.tar.gz |
cli.py: Use utils' search upwards helper when searching for project.conf
This is a part of #222
Diffstat (limited to 'buildstream')
-rw-r--r-- | buildstream/_frontend/cli.py | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/buildstream/_frontend/cli.py b/buildstream/_frontend/cli.py index ef0dadb13..b2ad1e8a4 100644 --- a/buildstream/_frontend/cli.py +++ b/buildstream/_frontend/cli.py @@ -59,18 +59,9 @@ def complete_target(args, incomplete): :return: all the possible user-specified completions for the param """ + from .. import utils project_conf = 'project.conf' - def ensure_project_dir(directory): - directory = os.path.abspath(directory) - while not os.path.isfile(os.path.join(directory, project_conf)): - parent_dir = os.path.dirname(directory) - if directory == parent_dir: - break - directory = parent_dir - - return directory - # First resolve the directory, in case there is an # active --directory/-C option # @@ -89,7 +80,7 @@ def complete_target(args, incomplete): else: # Check if this directory or any of its parent directories # contain a project config file - base_directory = ensure_project_dir(base_directory) + base_directory, _ = utils._search_upward_for_files(base_directory, [project_conf]) # Now parse the project.conf just to find the element path, # this is unfortunately a bit heavy. |