summaryrefslogtreecommitdiffstats
path: root/misc/scripts/check_get_file_list.py
blob: d536a7a9b01c8e0a54cff6939eb57513f4f154f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python

import os, sys

from pathlib import Path

sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", ".."))

from binding_generator import get_file_list, generate_bindings

api_filepath = "gdextension/extension_api.json"
bits = "64"
precision = "single"
output_dir = "self_test"

generate_bindings(api_filepath, use_template_get_node=False, bits=bits, precision=precision, output_dir=output_dir)
flist = get_file_list(api_filepath, output_dir, headers=True, sources=True)

p = Path(output_dir) / "gen"
allfiles = [str(f.as_posix()) for f in p.glob("**/*.*")]
missing = list(filter((lambda f: f not in flist), allfiles))
extras = list(filter((lambda f: f not in allfiles), flist))
if len(missing) > 0 or len(extras) > 0:
    print("Error!")
    for f in missing:
        print("MISSING: " + str(f))
    for f in extras:
        print("EXTRA: " + str(f))
    sys.exit(1)
else:
    print("OK!")