mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-23 07:20:56 +00:00
Modify build_tree.py for the PSA Crypto repo
When detecting the root dir, look both for PSA Crypto and Mbed TLS directories. Signed-off-by: David Horstmann <david.horstmann@arm.com>
This commit is contained in:
parent
9a6c45b436
commit
795d8b523d
@ -19,12 +19,19 @@
|
|||||||
import os
|
import os
|
||||||
import inspect
|
import inspect
|
||||||
|
|
||||||
|
def looks_like_psa_crypto_root(path: str) -> bool:
|
||||||
|
"""Whether the given directory looks like the root of the PSA Crypto source tree."""
|
||||||
|
return all(os.path.isdir(os.path.join(path, subdir))
|
||||||
|
for subdir in ['include', 'core', 'tests'])
|
||||||
|
|
||||||
def looks_like_mbedtls_root(path: str) -> bool:
|
def looks_like_mbedtls_root(path: str) -> bool:
|
||||||
"""Whether the given directory looks like the root of the Mbed TLS source tree."""
|
"""Whether the given directory looks like the root of the Mbed TLS source tree."""
|
||||||
return all(os.path.isdir(os.path.join(path, subdir))
|
return all(os.path.isdir(os.path.join(path, subdir))
|
||||||
for subdir in ['include', 'library', 'programs', 'tests'])
|
for subdir in ['include', 'library', 'programs', 'tests'])
|
||||||
|
|
||||||
|
def looks_like_root(path: str) -> bool:
|
||||||
|
return looks_like_psa_crypto_root(path) or looks_like_mbedtls_root(path)
|
||||||
|
|
||||||
def check_repo_path():
|
def check_repo_path():
|
||||||
"""
|
"""
|
||||||
Check that the current working directory is the project root, and throw
|
Check that the current working directory is the project root, and throw
|
||||||
@ -42,7 +49,7 @@ def chdir_to_root() -> None:
|
|||||||
for d in [os.path.curdir,
|
for d in [os.path.curdir,
|
||||||
os.path.pardir,
|
os.path.pardir,
|
||||||
os.path.join(os.path.pardir, os.path.pardir)]:
|
os.path.join(os.path.pardir, os.path.pardir)]:
|
||||||
if looks_like_mbedtls_root(d):
|
if looks_like_root(d):
|
||||||
os.chdir(d)
|
os.chdir(d)
|
||||||
return
|
return
|
||||||
raise Exception('Mbed TLS source tree not found')
|
raise Exception('Mbed TLS source tree not found')
|
||||||
@ -62,6 +69,6 @@ def guess_mbedtls_root():
|
|||||||
if d in dirs:
|
if d in dirs:
|
||||||
continue
|
continue
|
||||||
dirs.add(d)
|
dirs.add(d)
|
||||||
if looks_like_mbedtls_root(d):
|
if looks_like_root(d):
|
||||||
return d
|
return d
|
||||||
raise Exception('Mbed TLS source tree not found')
|
raise Exception('Mbed TLS source tree not found')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user