2017-03-30 22:41 GMT+02:00 Dawid Zamirski <dzamirski(a)datto.com>:
This patch updates the code generator that outputs C headers and
code
for WMI classes. It has been updated to handle multiple versions (or
namespaces) of the same class which were introduced with Hyperv 2012+
---
changes in v3:
* do not change file mode
* restore accidentally deleted copyright notice
src/hyperv/hyperv_wmi_generator.py | 387 +++++++++++++++++++++++++++----------
1 file changed, 283 insertions(+), 104 deletions(-)
diff --git a/src/hyperv/hyperv_wmi_generator.py b/src/hyperv/hyperv_wmi_generator.py
index 8c62882..ccad04d 100755
--- a/src/hyperv/hyperv_wmi_generator.py
+++ b/src/hyperv/hyperv_wmi_generator.py
@@ -279,31 +467,22 @@ def main():
if block is not None:
if line == "end":
if block[0][1].startswith("class"):
- cls = parse_class(block)
- classes_by_name[cls.name] = cls
+ parse_class(block)
block = None
else:
block.append((number, line))
- # write output files
- notice = "/* Generated by hyperv_wmi_generator.py */\n\n\n\n"
-
- header.write(notice)
- source.write(notice)
- classes_typedef.write(notice)
- classes_header.write(notice)
- classes_source.write(notice)
-
- names = classes_by_name.keys()
+ names = wmi_classes_by_name.keys()
names.sort()
for name in names:
- header.write(classes_by_name[name].generate_header())
- source.write(classes_by_name[name].generate_source())
- classes_typedef.write(classes_by_name[name].generate_classes_typedef())
- classes_header.write(classes_by_name[name].generate_classes_header())
- classes_source.write(classes_by_name[name].generate_classes_source())
+ cls = wmi_classes_by_name[name]
+ cls.prepare()
+
+ classes_typedef.write(cls.generate_classes_typedef())
+ classes_header.write(cls.generate_classes_header())
+ classes_source.write(cls.generate_classes_source())
You're dropping the notice comment from the generated files. Is this
intentional?
--
Matthias Bolte
http://photron.blogspot.com