mirror of
https://github.com/espressif/mbedtls.git
synced 2025-05-12 05:03:00 +08:00
Modify crypto_core_directory to also return a relative path
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
This commit is contained in:
parent
99030e2a50
commit
04c446cc21
@ -22,16 +22,23 @@ def looks_like_mbedtls_root(path: str) -> bool:
|
|||||||
def looks_like_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)
|
return looks_like_tf_psa_crypto_root(path) or looks_like_mbedtls_root(path)
|
||||||
|
|
||||||
def crypto_core_directory(root: Optional[str] = None) -> str:
|
def crypto_core_directory(root: Optional[str] = None, relative: Optional[bool] = False) -> str:
|
||||||
"""
|
"""
|
||||||
Return the path of the directory containing the PSA crypto core
|
Return the path of the directory containing the PSA crypto core
|
||||||
for either TF-PSA-Crypto or Mbed TLS.
|
for either TF-PSA-Crypto or Mbed TLS.
|
||||||
|
|
||||||
|
Returns either the full path or relative path depending on the
|
||||||
|
"relative" boolean argument.
|
||||||
"""
|
"""
|
||||||
if root is None:
|
if root is None:
|
||||||
root = guess_project_root()
|
root = guess_project_root()
|
||||||
if looks_like_tf_psa_crypto_root(root):
|
if looks_like_tf_psa_crypto_root(root):
|
||||||
|
if relative:
|
||||||
|
return "core"
|
||||||
return os.path.join(root, "core")
|
return os.path.join(root, "core")
|
||||||
elif looks_like_mbedtls_root(root):
|
elif looks_like_mbedtls_root(root):
|
||||||
|
if relative:
|
||||||
|
return "library"
|
||||||
return os.path.join(root, "library")
|
return os.path.join(root, "library")
|
||||||
else:
|
else:
|
||||||
raise Exception('Neither Mbed TLS nor TF-PSA-Crypto source tree found')
|
raise Exception('Neither Mbed TLS nor TF-PSA-Crypto source tree found')
|
||||||
|
@ -51,7 +51,7 @@ def main(library_build_dir: str):
|
|||||||
in_tf_psa_crypto_repo = build_tree.looks_like_tf_psa_crypto_root(root_dir)
|
in_tf_psa_crypto_repo = build_tree.looks_like_tf_psa_crypto_root(root_dir)
|
||||||
|
|
||||||
crypto_name = build_tree.crypto_library_filename(root_dir)
|
crypto_name = build_tree.crypto_library_filename(root_dir)
|
||||||
library_subdir = build_tree.crypto_core_directory(root_dir)
|
library_subdir = build_tree.crypto_core_directory(root_dir, relative = True)
|
||||||
|
|
||||||
crypto_lib_filename = (library_build_dir + '/' +
|
crypto_lib_filename = (library_build_dir + '/' +
|
||||||
library_subdir + '/' +
|
library_subdir + '/' +
|
||||||
|
Loading…
x
Reference in New Issue
Block a user