lbkit 0.5.8__tar.gz → 0.5.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. {lbkit-0.5.8/lbkit.egg-info → lbkit-0.5.9}/PKG-INFO +1 -1
  2. lbkit-0.5.9/lbkit/__init__.py +2 -0
  3. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/codegen/idf_interface.py +6 -0
  4. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/codegen/template/public.c.mako +10 -2
  5. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/codegen/template/server.c.mako +3 -1
  6. {lbkit-0.5.8 → lbkit-0.5.9/lbkit.egg-info}/PKG-INFO +1 -1
  7. lbkit-0.5.8/lbkit/__init__.py +0 -2
  8. {lbkit-0.5.8 → lbkit-0.5.9}/AUTHORS +0 -0
  9. {lbkit-0.5.8 → lbkit-0.5.9}/LICENSE +0 -0
  10. {lbkit-0.5.8 → lbkit-0.5.9}/MANIFEST.in +0 -0
  11. {lbkit-0.5.8 → lbkit-0.5.9}/README.md +0 -0
  12. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/ci_robot/__init__.py +0 -0
  13. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/ci_robot/gitee.py +0 -0
  14. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/cli.py +0 -0
  15. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/codegen/__init__.py +0 -0
  16. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/codegen/codegen.py +0 -0
  17. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/codegen/ctype_defination.py +0 -0
  18. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/codegen/renderer.py +0 -0
  19. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/codegen/template/client.c.mako +0 -0
  20. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/codegen/template/client.h.mako +0 -0
  21. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/codegen/template/interface.c.mako +0 -0
  22. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/codegen/template/interface.introspect.xml.mako +0 -0
  23. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/codegen/template/public.h.mako +0 -0
  24. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/codegen/template/server.h.mako +0 -0
  25. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/component/__init__.py +0 -0
  26. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/component/arg_parser.py +0 -0
  27. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/component/build.py +0 -0
  28. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/component/template/conanbase.mako +0 -0
  29. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/component/template/deploy.mako +0 -0
  30. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/component/test.py +0 -0
  31. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/errors.py +0 -0
  32. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/helper.py +0 -0
  33. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/integration/__init__.py +0 -0
  34. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/integration/build_manifest.py +0 -0
  35. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/integration/build_prepare.py +0 -0
  36. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/integration/build_rootfs.py +0 -0
  37. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/integration/config.py +0 -0
  38. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/integration/task.py +0 -0
  39. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/integration/template/conanfile.py.mako +0 -0
  40. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/lbkit.py +0 -0
  41. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/log.py +0 -0
  42. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/misc.py +0 -0
  43. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit/tools.py +0 -0
  44. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit.egg-info/SOURCES.txt +0 -0
  45. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit.egg-info/dependency_links.txt +0 -0
  46. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit.egg-info/entry_points.txt +0 -0
  47. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit.egg-info/requires.txt +0 -0
  48. {lbkit-0.5.8 → lbkit-0.5.9}/lbkit.egg-info/top_level.txt +0 -0
  49. {lbkit-0.5.8 → lbkit-0.5.9}/setup.cfg +0 -0
  50. {lbkit-0.5.8 → lbkit-0.5.9}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lbkit
3
- Version: 0.5.8
3
+ Version: 0.5.9
4
4
  Summary: Tools provided by litebmc.com
5
5
  Home-page: https://www.litebmc.com
6
6
  Author: xuhj@litebmc.com
@@ -0,0 +1,2 @@
1
+
2
+ __version__ = '0.5.9'
@@ -48,6 +48,7 @@ ANNOTATION_MAP = {
48
48
  "emits_false": IdfAnnotation("org.freedesktop.DBus.Property.EmitsChangedSignal", "false"),
49
49
  "private": IdfAnnotation("com.litebmc.Dbus.Property.Private", "const"),
50
50
  "refobj": IdfAnnotation("com.litebmc.Dbus.Property.RefObject", "true"),
51
+ "required": IdfAnnotation("com.litebmc.Dbus.Property.Required", "true"),
51
52
  }
52
53
 
53
54
  ACCESS_MAP = {
@@ -715,7 +716,10 @@ class IdfInterface(IdfInterfaceBase):
715
716
  def odf_schema(self):
716
717
  schema = {}
717
718
  with_schema_prop_cnt = 0
719
+ required = []
718
720
  for prop in self.properties:
721
+ if "required" in prop.flags:
722
+ required.append(prop.name)
719
723
  odf = prop.odf_schema(True)
720
724
  if odf is not None:
721
725
  schema[prop.name] = odf
@@ -734,6 +738,8 @@ class IdfInterface(IdfInterfaceBase):
734
738
  "type": "object",
735
739
  "additionalProperties": False
736
740
  }
741
+ if len(required) > 0:
742
+ odf["required"] = required
737
743
  if with_schema_prop_cnt > 0:
738
744
  odf["properties"] = schema
739
745
  odf["$defs"] = {
@@ -176,6 +176,7 @@ gboolean _validate_odf_as_struct_${name}(yaml_document_t *doc, yaml_node_t *node
176
176
  g_string_truncate(prop, len);
177
177
  }
178
178
  % endfor
179
+ g_hash_table_destroy(prop_table);
179
180
  return valid;
180
181
  }
181
182
 
@@ -1161,8 +1162,14 @@ static gboolean _validate_odf_prop_${prop.name}(yaml_document_t *doc, GHashTable
1161
1162
  gsize len = prop->len;
1162
1163
  yaml_node_t *node = g_hash_table_lookup(prop_table, "${prop.name}");
1163
1164
  do {
1164
- if (!node)
1165
+ if (!node) {
1166
+ ## 检查属性是否存在
1167
+ % if "required" in prop.flags:
1168
+ *error_list = g_slist_append(*error_list, g_error_new(ODF_ERROR, ODF_ERROR_PROP_MISSING, "Property %s is missing", prop->str));
1169
+ valid = FALSE;
1170
+ % endif
1165
1171
  break;
1172
+ }
1166
1173
  g_string_append(prop, ".${prop.name}");
1167
1174
  % if "refobj" not in prop.flags:
1168
1175
  if (validate_odf_as_ref_prop(doc, node, prop))
@@ -1197,13 +1204,14 @@ gboolean ${intf.name.replace(".", "_")}_validate_odf(yaml_document_t *doc, yaml_
1197
1204
  "the node type of object %s is not a mapping, get %s", object_name, gcl_yaml_node_type_str(node->type)));
1198
1205
  return FALSE;
1199
1206
  }
1200
- GString *prop = g_string_sized_new(128);
1207
+ cleanup_gstring GString *prop = g_string_sized_new(128);
1201
1208
  g_string_printf(prop, "%s", object_name);
1202
1209
  gboolean valid = TRUE;
1203
1210
  GHashTable *prop_table = load_yaml_mapping_to_hash_table(doc, node);
1204
1211
  % for prop in stru.values.parameters:
1205
1212
  valid = _validate_odf_prop_${prop.name}(doc, prop_table, prop, error_list) && valid;
1206
1213
  % endfor
1214
+ g_hash_table_destroy(prop_table);
1207
1215
  return valid;
1208
1216
  }
1209
1217
 
@@ -272,9 +272,11 @@ static void _load_odf_as_prop_${prop.name}(yaml_document_t *doc, GHashTable *pro
272
272
  flags = val->data.scalar.value;
273
273
  }
274
274
  val = g_hash_table_lookup(prop_table, "${prop.name}");
275
+ ## validate接口在加载odf前完成属性是否必选校验,此处如果是必选属性一定存在
275
276
  if (!val) {
276
277
  if (flags) {
277
- ref_loaded(obj, &${properties}.${prop.name}, NULL, NULL, user_data, flags);
278
+ ## 属性不存在时传入的value为空,需要开发者在回调函数中完成异常(有flags无属性值)处理
279
+ ref_loaded(obj, &${properties}.${prop.name}, doc, NULL, user_data, flags);
278
280
  }
279
281
  return;
280
282
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lbkit
3
- Version: 0.5.8
3
+ Version: 0.5.9
4
4
  Summary: Tools provided by litebmc.com
5
5
  Home-page: https://www.litebmc.com
6
6
  Author: xuhj@litebmc.com
@@ -1,2 +0,0 @@
1
-
2
- __version__ = '0.5.8'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes