Index: mojo/public/tools/bindings/generators/python_templates/module.py.tmpl |
diff --git a/mojo/public/tools/bindings/generators/python_templates/module.py.tmpl b/mojo/public/tools/bindings/generators/python_templates/module.py.tmpl |
index f76d255839551a57aa1fa9477a8a05b1f921abd5..aa631d92fe6016ef5b2961f4efc27b6c929041d2 100644 |
--- a/mojo/public/tools/bindings/generators/python_templates/module.py.tmpl |
+++ b/mojo/public/tools/bindings/generators/python_templates/module.py.tmpl |
@@ -1,3 +1,4 @@ |
+{% from "module_macros.tmpl" import enum_values %} |
# Copyright 2014 The Chromium Authors. All rights reserved. |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
@@ -18,11 +19,28 @@ import {{import.python_module}} |
{% endif %} |
{% for enum in module.enums %} |
-class {{enum.name}}(object): |
+class {{enum|name}}(object): |
__metaclass__ = _reflection.MojoEnumType |
- VALUES = [ |
-{% for field in enum.fields %} |
- ('{{field.name}}', {{field.computed_value}}), |
-{% endfor %} |
- ] |
+ VALUES = {{enum_values(enum)|indent(2)}} |
+{% endfor %} |
+{% for struct in module.structs %} |
+ |
+class {{struct|name}}(object): |
+ __metaclass__ = _reflection.MojoStructType |
+ DESCRIPTOR = { |
+{% if struct.constants %} |
+ 'constants': { |
+{% for constant in struct.constants %} |
+ '{{constant|name}}': {{constant.value|expression_to_text}}, |
+{% endfor %} |
+ }, |
+{% endif %} |
+{% if struct.enums %} |
+ 'enums': { |
+{% for enum in struct.enums %} |
+ '{{enum|name}}': {{enum_values(enum)|indent(6)}}, |
+{% endfor %} |
+ }, |
+{% endif %} |
+ } |
{% endfor %} |