FEX/Scripts/json_asm_config_parse.py
Ryan Houdek 31afb62a2a Split python unit test ASM config parser code out to an independent file
This will be needed once we have multiple file type configs getting
parsed
2020-05-09 12:14:59 -07:00

22 lines
490 B
Python

from enum import Flag
import json
import struct
import sys
from json_config_parse import parse_json
if (len(sys.argv) < 3):
sys.exit()
output_file = sys.argv[2]
asm_file = open(sys.argv[1], "r")
asm_text = asm_file.read()
asm_file.close()
json_text = asm_text.split("%ifdef CONFIG")
if (len(json_text) > 1):
json_text = json_text[1].split("%endif")
if (len(json_text) > 1):
json_text = json_text[0].strip()
parse_json(json_text, output_file)