Rename variables in script
Rename some variables in generate_driver_wrappers.py now that the script has to work in two repositories as opposed to just mbed tls. Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
This commit is contained in:
parent
4291bc27b9
commit
5556f908cb
1 changed files with 15 additions and 15 deletions
|
@ -108,17 +108,17 @@ def load_driver(schemas: Dict[str, Any], driver_file: str) -> Any:
|
||||||
return json_data
|
return json_data
|
||||||
|
|
||||||
|
|
||||||
def load_schemas(mbedtls_root: str) -> Dict[str, Any]:
|
def load_schemas(repo_root: str) -> Dict[str, Any]:
|
||||||
"""
|
"""
|
||||||
Load schemas map
|
Load schemas map
|
||||||
"""
|
"""
|
||||||
schema_file_paths = {
|
schema_file_paths = {
|
||||||
'transparent': os.path.join(mbedtls_root,
|
'transparent': os.path.join(repo_root,
|
||||||
'scripts',
|
'scripts',
|
||||||
'data_files',
|
'data_files',
|
||||||
'driver_jsons',
|
'driver_jsons',
|
||||||
'driver_transparent_schema.json'),
|
'driver_transparent_schema.json'),
|
||||||
'opaque': os.path.join(mbedtls_root,
|
'opaque': os.path.join(repo_root,
|
||||||
'scripts',
|
'scripts',
|
||||||
'data_files',
|
'data_files',
|
||||||
'driver_jsons',
|
'driver_jsons',
|
||||||
|
@ -131,13 +131,13 @@ def load_schemas(mbedtls_root: str) -> Dict[str, Any]:
|
||||||
return driver_schema
|
return driver_schema
|
||||||
|
|
||||||
|
|
||||||
def read_driver_descriptions(mbedtls_root: str,
|
def read_driver_descriptions(repo_root: str,
|
||||||
json_directory: str,
|
json_directory: str,
|
||||||
jsondriver_list: str) -> list:
|
jsondriver_list: str) -> list:
|
||||||
"""
|
"""
|
||||||
Merge driver JSON files into a single ordered JSON after validation.
|
Merge driver JSON files into a single ordered JSON after validation.
|
||||||
"""
|
"""
|
||||||
driver_schema = load_schemas(mbedtls_root)
|
driver_schema = load_schemas(repo_root)
|
||||||
|
|
||||||
with open(file=os.path.join(json_directory, jsondriver_list),
|
with open(file=os.path.join(json_directory, jsondriver_list),
|
||||||
mode='r',
|
mode='r',
|
||||||
|
@ -163,11 +163,11 @@ def main() -> int:
|
||||||
"""
|
"""
|
||||||
Main with command line arguments.
|
Main with command line arguments.
|
||||||
"""
|
"""
|
||||||
def_arg_mbedtls_root = build_tree.guess_mbedtls_root()
|
def_arg_repo_root = build_tree.guess_mbedtls_root()
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('--mbedtls-root', default=def_arg_mbedtls_root,
|
parser.add_argument('--repo-root', default=def_arg_repo_root,
|
||||||
help='root directory of mbedtls source code')
|
help='root directory of repo source code')
|
||||||
parser.add_argument('--template-dir',
|
parser.add_argument('--template-dir',
|
||||||
help='directory holding the driver templates')
|
help='directory holding the driver templates')
|
||||||
parser.add_argument('--json-dir',
|
parser.add_argument('--json-dir',
|
||||||
|
@ -176,31 +176,31 @@ def main() -> int:
|
||||||
help='output file\'s location')
|
help='output file\'s location')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
mbedtls_root = os.path.abspath(args.mbedtls_root)
|
repo_root = os.path.abspath(args.repo_root)
|
||||||
|
|
||||||
library_dir = ''
|
library_dir = ''
|
||||||
if build_tree.looks_like_mbedtls_root(mbedtls_root):
|
if build_tree.looks_like_mbedtls_root(repo_root):
|
||||||
library_dir = 'library'
|
library_dir = 'library'
|
||||||
elif build_tree.looks_like_tf_psa_crypto_root(mbedtls_root):
|
elif build_tree.looks_like_tf_psa_crypto_root(repo_root):
|
||||||
library_dir = 'core'
|
library_dir = 'core'
|
||||||
|
|
||||||
output_directory = args.output_directory if args.output_directory is not None else \
|
output_directory = args.output_directory if args.output_directory is not None else \
|
||||||
os.path.join(mbedtls_root, library_dir)
|
os.path.join(repo_root, library_dir)
|
||||||
|
|
||||||
template_directory = args.template_dir if args.template_dir is not None else \
|
template_directory = args.template_dir if args.template_dir is not None else \
|
||||||
os.path.join(mbedtls_root,
|
os.path.join(repo_root,
|
||||||
'scripts',
|
'scripts',
|
||||||
'data_files',
|
'data_files',
|
||||||
'driver_templates')
|
'driver_templates')
|
||||||
json_directory = args.json_dir if args.json_dir is not None else \
|
json_directory = args.json_dir if args.json_dir is not None else \
|
||||||
os.path.join(mbedtls_root,
|
os.path.join(repo_root,
|
||||||
'scripts',
|
'scripts',
|
||||||
'data_files',
|
'data_files',
|
||||||
'driver_jsons')
|
'driver_jsons')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Read and validate list of driver jsons from driverlist.json
|
# Read and validate list of driver jsons from driverlist.json
|
||||||
merged_driver_json = read_driver_descriptions(mbedtls_root,
|
merged_driver_json = read_driver_descriptions(repo_root,
|
||||||
json_directory,
|
json_directory,
|
||||||
'driverlist.json')
|
'driverlist.json')
|
||||||
except DriverReaderException as e:
|
except DriverReaderException as e:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue