From 67741248cfa6bfe319c75521ed9719af7cd27cb5 Mon Sep 17 00:00:00 2001 From: Scott Lee Date: Mon, 10 Nov 2025 13:01:27 -0800 Subject: [PATCH] skip printing a warning message for missing .gclient_entries on cog The function prints a warning message when it finds that a given directory contains .gclient only without .gclient_entries. It can possibly happen if gclient sync execution is halted in the middle, and it causes format function commands to mess up the format output with the warning message. This CL is to bypass the warning in Cog env. Find more context visit the linked bug. Bug: 450901048 Change-Id: I87e376e9a64c8e2ce2231dc9549e0683a9f393ef Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7133882 Commit-Queue: Scott Lee Auto-Submit: Scott Lee Reviewed-by: Terrence Reilly --- gclient_paths.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/gclient_paths.py b/gclient_paths.py index 1bcb091da2..bd4d05b157 100644 --- a/gclient_paths.py +++ b/gclient_paths.py @@ -40,14 +40,16 @@ def FindGclientRoot(from_dir, filename='.gclient'): # a sub directory that is controlled by this configuration. entries_filename = os.path.join(path, filename + '_entries') if not os.path.exists(entries_filename): - # If .gclient_entries does not exist, a previous call to gclient sync - # might have failed. In that case, we cannot verify that the .gclient - # is the one we want to use. In order to not to cause too much trouble, - # just issue a warning and return the path anyway. - print( - "%s missing, %s file in parent directory %s might not be the file " - "you want to use." % (entries_filename, filename, path), - file=sys.stderr) + if not gclient_utils.IsEnvCog(): + # If .gclient_entries does not exist, a previous call to + # gclient sync might have failed. In that case, we cannot verify + # that the .gclient is the one we want to use. In order to not + # to cause too much trouble, just issue a warning and return + # the path anyway. + print("%s missing, %s file in parent directory %s might not be " + "the file you want to use." % + (entries_filename, filename, path), + file=sys.stderr) return path entries_content = gclient_utils.FileRead(entries_filename)