
4 changed files with 63 additions and 5 deletions
@ -0,0 +1,58 @@ |
|||
#!/usr/bin/env python3 |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
import sys |
|||
import json |
|||
import gen_cid |
|||
from gen_cid import utils |
|||
|
|||
|
|||
def print_indent(*args, indent=0): |
|||
print('\t' * indent, *args) |
|||
|
|||
def main(): |
|||
cfg_file = sys.argv[1] |
|||
print("reading cfg file:", cfg_file) |
|||
data = [] |
|||
try: |
|||
with open(cfg_file) as json_data_file: |
|||
data = json.load(json_data_file) |
|||
except IOError: |
|||
print("cfg file not readble:", cfg_file) |
|||
exit(-1) |
|||
|
|||
|
|||
pymodule_name = data["module_name"] |
|||
libclang_path = data["libclang_path"] |
|||
|
|||
header_filename = data["header_filename"] |
|||
vars = data["variables"] |
|||
funcs = data["functions"] |
|||
|
|||
|
|||
print_indent("CONFIG:") |
|||
print_indent("module_name:", pymodule_name, indent=1) |
|||
|
|||
print_indent("libclang_path:", libclang_path, indent=1) |
|||
|
|||
print_indent("header_filename:", header_filename, indent=1) |
|||
|
|||
print_indent("variables:", indent=1) |
|||
for var in vars: |
|||
print_indent(var, indent=2) |
|||
|
|||
print_indent("functions:", indent=1) |
|||
for func in funcs: |
|||
print_indent(func, indent=2) |
|||
|
|||
|
|||
cidtools = gen_cid.CIDTools(libclang_path, header_filename, pymodule_name) |
|||
header = cidtools.extract(vars, funcs, debug_ast=False, debug_cid=False, debug_yml=False) |
|||
|
|||
print_indent("OUTPUT:") |
|||
print_indent(header["yml"]) |
|||
utils.write_string(header["yml"], "./" + "py_module" + ".yml2", ) |
|||
|
|||
|
|||
if __name__ == "__main__": |
|||
main() |
Loading…
Reference in new issue