Replace FindSrcDirPath

If the webrtc/src repo is checked out in a directory that isn't named
"src", FindSrcDirPath will loop forever. Instead of trying to find the
repo root, just use the location of the scripts and work out the
root with os.pardir.

Bug: b/333744051
Change-Id: Ifccdb85d3f9c7cb27ca57cc0b7bb96adf783660d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/357980
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Cr-Commit-Position: refs/heads/main@{#42701}
This commit is contained in:
Gavin Mak 2024-07-27 05:50:54 +00:00 committed by WebRTC LUCI CQ
parent bde30d393b
commit c51a5c00c4
3 changed files with 7 additions and 27 deletions

View File

@ -21,14 +21,6 @@ import sys
import urllib.request
def FindSrcDirPath():
"""Returns the abs path to the src/ dir of the project."""
src_dir = os.path.dirname(os.path.abspath(__file__))
while os.path.basename(src_dir) != 'src':
src_dir = os.path.normpath(os.path.join(src_dir, os.pardir))
return src_dir
# Skip these dependencies (list without solution name prefix).
DONT_AUTOROLL_THESE = [
'src/examples/androidtests/third_party/gradle',
@ -66,7 +58,8 @@ CLANG_REVISION_RE = re.compile(r'^CLANG_REVISION = \'([-0-9a-z]+)\'$')
ROLL_BRANCH_NAME = 'roll_chromium_revision'
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
CHECKOUT_SRC_DIR = FindSrcDirPath()
CHECKOUT_SRC_DIR = os.path.realpath(
os.path.join(SCRIPT_DIR, os.pardir, os.pardir))
CHECKOUT_ROOT_DIR = os.path.realpath(os.path.join(CHECKOUT_SRC_DIR, os.pardir))
# Copied from tools/android/roll/android_deps/.../BuildConfigGenerator.groovy.

View File

@ -19,15 +19,8 @@ import sys
import tempfile
def find_src_dir_path():
"""Returns the abs path to the src/ dir of the project."""
src_dir = os.path.dirname(os.path.abspath(__file__))
while os.path.basename(src_dir) != 'src':
src_dir = os.path.normpath(os.path.join(src_dir, os.pardir))
return src_dir
SRC_DIR = find_src_dir_path()
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
SRC_DIR = os.path.realpath(os.path.join(SCRIPT_DIR, os.pardir, os.pardir))
sys.path.append(os.path.join(SRC_DIR, 'build'))
import find_depot_tools

View File

@ -19,16 +19,10 @@ import subprocess
import sys
def find_src_dir_path():
"""Returns the abs path to the src/ dir of the project."""
src_dir = os.path.dirname(os.path.abspath(__file__))
while os.path.basename(src_dir) != 'src':
src_dir = os.path.normpath(os.path.join(src_dir, os.pardir))
return src_dir
UPDATE_BRANCH_NAME = 'webrtc_version_update'
CHECKOUT_SRC_DIR = find_src_dir_path()
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
CHECKOUT_SRC_DIR = os.path.realpath(
os.path.join(SCRIPT_DIR, os.pardir, os.pardir))
NOTIFY_EMAIL = 'webrtc-trooper@webrtc.org'