On Sat, 2017-04-01 at 14:22 +0200, Matthias Bolte wrote:
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_class
> es_typedef())
> - classes_header.write(classes_by_name[name].generate_classe
> s_header())
> - classes_source.write(classes_by_name[name].generate_classe
> s_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?
Nope, not intentional - I'll fix this in v2 for the series. I'll wait
till all the remaining patches get reviewed and then send v2 with all
the issues addressed.
Regards,
Dawid