Skip to content

Commit 2f718ab

Browse files
check_committed_generated_files.py: use the new generate_files_helper module
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
1 parent 6c1fb33 commit 2f718ab

1 file changed

Lines changed: 8 additions & 34 deletions

File tree

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,20 @@
11
#!/usr/bin/env python3
22

33
"""
4-
Check that files with lists of config options are up-to-date, or update them.
5-
6-
This script checks the following file:
7-
scripts/data_files/config-options-current.txt
4+
Check that TF-PSA-Crypto files that can be regenerated are up-to-date, or update them.
85
"""
96

107
# Copyright The Mbed TLS Contributors
118
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
129

13-
import argparse
14-
import sys
15-
1610
import scripts_path # pylint: disable=unused-import
1711
from mbedtls_framework import config_macros
12+
from mbedtls_framework import generate_files_helper
1813

14+
GENERATORS = [
15+
config_macros.Current(shadow_missing_ok=True),
16+
]
1917

20-
def main():
21-
parser = argparse.ArgumentParser(description=__doc__)
22-
# For now this script only acts on one target file.
23-
# If we check/update more files, we should add a way to select which
24-
# file(s) to operate on.
25-
parser.add_argument('--always-update', '-U',
26-
action='store_true',
27-
help=('Update target files unconditionally '
28-
'(overrides --update)'))
29-
parser.add_argument('--update', '-u',
30-
action='store_true',
31-
help='Update target files if needed')
32-
args = parser.parse_args()
33-
data = config_macros.Current(shadow_missing_ok=True)
34-
if args.update or args.always_update:
35-
data.update_shadow_file(args.always_update)
36-
else:
37-
up_to_date = True
38-
if not data.is_shadow_file_up_to_date():
39-
print(f'{data.shadow_file_path()} is out of date')
40-
print(f'After adding or removing a config option, you need to run')
41-
print(f'{sys.argv[0]} -u and commit the result.')
42-
up_to_date = False
43-
sys.exit(0 if up_to_date else 1)
44-
45-
if __name__ == "__main__":
46-
main()
18+
if __name__ == '__main__':
19+
generate_files_helper.main(generators=GENERATORS,
20+
description=__doc__)

0 commit comments

Comments
 (0)