Introduce function to return library/core directory

Add crypto_core_directory in build_tree.py so that
the libary/core directory can be returned based
on what repository we are in.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
This commit is contained in:
Thomas Daubney 2023-11-16 18:34:58 +00:00
parent 5556f908cb
commit 13ecb691a3

View File

@ -21,6 +21,14 @@ def looks_like_mbedtls_root(path: str) -> bool:
def looks_like_root(path: str) -> bool:
return looks_like_tf_psa_crypto_root(path) or looks_like_mbedtls_root(path)
def crypto_core_directory() -> str:
if looks_like_tf_psa_crypto_root(os.path.curdir):
return "core"
elif looks_like_mbedtls_root(os.path.curdir):
return "library"
else:
raise Exception('Neither Mbed TLS nor TF-PSA-Crypto source tree found')
def check_repo_path():
"""
Check that the current working directory is the project root, and throw