Fix generate_licenses Presubmit when working within chromium
When working within chromium, we need to move up two more levels before we can import the "find_depot_tools" module. Previously this was managed by a loop that kept moving up until it found a directory named 'src', but this didn't work if the base-level webrtc code was not in a directory named 'src'. Bug: webrtc:14411 Change-Id: I2729603d6d2fd8242a1294ae5d95d946db619d0a Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/273561 Commit-Queue: Alexander Cooper <alcooper@chromium.org> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/main@{#37971}
This commit is contained in:

committed by
WebRTC LUCI CQ

parent
73e677817a
commit
813177d98f
@ -103,6 +103,13 @@ LIB_REGEX_TO_LICENSES_DICT = {
|
||||
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||
WEBRTC_ROOT = os.path.abspath(os.path.join(SCRIPT_DIR, os.pardir, os.pardir))
|
||||
SRC_DIR = os.path.dirname(os.path.dirname(SCRIPT_DIR))
|
||||
|
||||
# Chromium, and potentially other repositories, embed us in the location
|
||||
# "//third_party/webrtc". When this is the case, we expect that some of the
|
||||
# tools we need are *actually* in their build folder, thus we need to move up
|
||||
# to the *true* source root, when we're embedded like this.
|
||||
if SRC_DIR.endswith(os.path.join('third_party', 'webrtc')):
|
||||
SRC_DIR = os.path.abspath(os.path.join(SRC_DIR, os.pardir, os.pardir))
|
||||
sys.path.append(os.path.join(SRC_DIR, 'build'))
|
||||
import find_depot_tools
|
||||
|
||||
|
Reference in New Issue
Block a user