Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/env python3
# python vita-emd-gen.py db.yml
import sys
import yaml
with open(sys.argv[1]) as f:
db = yaml.load(f)
for module in db['modules']:
mod_nid = db['modules'][module]['nid']
#print(module + ": " + str(mod_nid))
emd_lib = "lib" + module + ".emd"
print(emd_lib)
emd_file = open(emd_lib, "w")
emd_file.write("moduleinfo_output_format: emd\n")
for library in db['modules'][module]['libraries']:
lib_nid = db['modules'][module]['libraries'][library]['nid']
#print(library + ": " + str(lib_nid))
emd_file.write("Library: " + library + " version: 1\n")
emd_file.write("Library: " + library + " nidsuffix: \"\"\n")
emd_file.write("Library: " + library + " libnamenid: " + str(lib_nid) + "\n")
for function in db['modules'][module]['libraries'][library]['functions']:
fun_nid = db['modules'][module]['libraries'][library]['functions'][function]
#print(function + ": " + str(fun_nid))
emd_file.write("Library: " + library + " function: " + function + " nidvalue: " + str(fun_nid) + "\n")
emd_file.write("Library: " + library + " StubFile: \"lib" + module + "_stub\"\n")
emd_file.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment