summaryrefslogtreecommitdiff
path: root/buildstream/_frontend/cli.py
diff options
context:
space:
mode:
Diffstat (limited to 'buildstream/_frontend/cli.py')
-rw-r--r--buildstream/_frontend/cli.py13
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.