Skip to content

Instantly share code, notes, and snippets.

@OsirizX
Created February 8, 2021 21:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OsirizX/1f54a3f32bb343f96b715d25257cc352 to your computer and use it in GitHub Desktop.
Save OsirizX/1f54a3f32bb343f96b715d25257cc352 to your computer and use it in GitHub Desktop.
#!/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