Rename guess_mbedtls_root to guess_project_root

Rename for consistency. Also, replace all calls to
this function with correct name.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
This commit is contained in:
Thomas Daubney 2023-11-22 17:18:22 +00:00
parent d35b94b662
commit 755d32117b
4 changed files with 8 additions and 8 deletions

View file

@ -163,7 +163,7 @@ def main() -> int:
"""
Main with command line arguments.
"""
def_arg_project_root = build_tree.guess_mbedtls_root()
def_arg_project_root = build_tree.guess_project_root()
parser = argparse.ArgumentParser()
parser.add_argument('--project-root', default=def_arg_project_root,

View file

@ -367,7 +367,7 @@ def generate_ssl_debug_helpers(output_directory, mbedtls_root):
Generate functions of debug helps
"""
mbedtls_root = os.path.abspath(
mbedtls_root or build_tree.guess_mbedtls_root())
mbedtls_root or build_tree.guess_project_root())
with open(os.path.join(mbedtls_root, 'include/mbedtls/ssl.h')) as f:
source_code = remove_c_comments(f.read())

View file

@ -24,7 +24,7 @@ def looks_like_root(path: str) -> bool:
def crypto_core_directory(root: Optional[str] = None) -> str:
if root is None:
root = guess_mbedtls_root()
root = guess_project_root()
if looks_like_tf_psa_crypto_root(root):
return "core"
elif looks_like_mbedtls_root(root):
@ -55,10 +55,10 @@ def chdir_to_root() -> None:
raise Exception('Mbed TLS source tree not found')
def guess_mbedtls_root():
"""Guess mbedTLS source code directory.
def guess_project_root():
"""Guess project source code directory.
Return the first possible mbedTLS root directory
Return the first possible project root directory.
"""
dirs = set({})
for frame in inspect.stack():
@ -71,4 +71,4 @@ def guess_mbedtls_root():
dirs.add(d)
if looks_like_root(d):
return d
raise Exception('Mbed TLS source tree not found')
raise Exception('Neither Mbed TLS nor TF-PSA-Crypto source tree found')

View file

@ -265,7 +265,7 @@ class Auditor:
@staticmethod
def find_test_dir():
"""Get the relative path for the Mbed TLS test directory."""
return os.path.relpath(build_tree.guess_mbedtls_root() + '/tests')
return os.path.relpath(build_tree.guess_project_root() + '/tests')
class TestDataAuditor(Auditor):