Skip to content

Commit 3ac2225

Browse files
authored
Cleanup tools/maint/check_struct_info.py. NFC (emscripten-core#15981)
1 parent 630954d commit 3ac2225

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

tools/maint/check_struct_info.py

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

3+
"""Find entries in struct_info.json that are not needd by
4+
any JS library code and can be removed."""
5+
36
import json
47
import os
58
import sys
@@ -14,23 +17,29 @@
1417
from tools.settings import settings
1518

1619

17-
def check_structs():
20+
def check_structs(info):
1821
for struct in info['structs'].keys():
1922
key = 'C_STRUCTS.' + struct + '.'
2023
# grep --quiet ruturns 0 when there is a match
2124
if subprocess.run(['git', 'grep', '--quiet', key], check=False).returncode != 0:
2225
print(struct)
2326

2427

25-
def check_defines():
28+
def check_defines(info):
2629
for define in info['defines'].keys():
2730
key = 'cDefine(.' + define + '.)'
2831
# grep --quiet ruturns 0 when there is a match
2932
if subprocess.run(['git', 'grep', '--quiet', key], check=False).returncode != 0:
3033
print(define)
3134

3235

33-
emscripten.generate_struct_info()
34-
info = json.loads(open(settings.STRUCT_INFO).read())
35-
check_structs()
36-
check_defines()
36+
def main():
37+
emscripten.generate_struct_info()
38+
info = json.loads(open(settings.STRUCT_INFO).read())
39+
check_structs(info)
40+
check_defines(info)
41+
return 0
42+
43+
44+
if __name__ == '__main__':
45+
sys.exit(main())

0 commit comments

Comments
 (0)