wireshark: simplify backend init
diff --git a/lang_wireshark.py b/lang_wireshark.py
index 509c9cd..3e862d2 100644
--- a/lang_wireshark.py
+++ b/lang_wireshark.py
@@ -36,15 +36,7 @@
loaded automatically by Wireshark.
"""
-import os
-import loxi_utils.loxi_utils as loxi_utils
import wireshark_gen
-targets = {
- 'wireshark/openflow.lua' : wireshark_gen.generate
-}
-
def generate():
- for (name, fn) in targets.items():
- with loxi_utils.open_output(name) as outfile:
- fn(outfile, os.path.basename(name))
+ wireshark_gen.generate()
diff --git a/wireshark_gen/__init__.py b/wireshark_gen/__init__.py
index c4ff7f4..1225131 100644
--- a/wireshark_gen/__init__.py
+++ b/wireshark_gen/__init__.py
@@ -111,8 +111,10 @@
return r
-def generate(out, name):
+def generate():
context = {
'fields': create_fields(),
}
- utils.render_template(out, "openflow.lua", [templates_dir], context)
+
+ with utils.open_output('openflow.lua') as out:
+ utils.render_template(out, "openflow.lua", [templates_dir], context)