lbkit 0.5.7__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.
- {lbkit-0.5.7/lbkit.egg-info → lbkit-0.5.9}/PKG-INFO +1 -1
- lbkit-0.5.9/lbkit/__init__.py +2 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/codegen/idf_interface.py +6 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/codegen/template/client.c.mako +17 -2
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/codegen/template/client.h.mako +12 -4
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/codegen/template/public.c.mako +27 -5
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/codegen/template/public.h.mako +10 -2
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/codegen/template/server.c.mako +12 -3
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/codegen/template/server.h.mako +5 -1
- {lbkit-0.5.7 → lbkit-0.5.9/lbkit.egg-info}/PKG-INFO +1 -1
- lbkit-0.5.7/lbkit/__init__.py +0 -2
- {lbkit-0.5.7 → lbkit-0.5.9}/AUTHORS +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/LICENSE +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/MANIFEST.in +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/README.md +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/ci_robot/__init__.py +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/ci_robot/gitee.py +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/cli.py +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/codegen/__init__.py +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/codegen/codegen.py +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/codegen/ctype_defination.py +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/codegen/renderer.py +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/codegen/template/interface.c.mako +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/codegen/template/interface.introspect.xml.mako +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/component/__init__.py +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/component/arg_parser.py +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/component/build.py +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/component/template/conanbase.mako +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/component/template/deploy.mako +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/component/test.py +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/errors.py +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/helper.py +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/integration/__init__.py +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/integration/build_manifest.py +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/integration/build_prepare.py +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/integration/build_rootfs.py +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/integration/config.py +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/integration/task.py +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/integration/template/conanfile.py.mako +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/lbkit.py +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/log.py +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/misc.py +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit/tools.py +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit.egg-info/SOURCES.txt +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit.egg-info/dependency_links.txt +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit.egg-info/entry_points.txt +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit.egg-info/requires.txt +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/lbkit.egg-info/top_level.txt +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/setup.cfg +0 -0
- {lbkit-0.5.7 → lbkit-0.5.9}/setup.py +0 -0
|
@@ -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"] = {
|
|
@@ -45,6 +45,14 @@ gint ${class_name}_get_${prop.name}(const ${class_name} *object, GVariant **valu
|
|
|
45
45
|
% endfor
|
|
46
46
|
|
|
47
47
|
% for method in intf.methods:
|
|
48
|
+
<% RSP_PARA = f'' %>\
|
|
49
|
+
<% REQ_PARA = f'' %>\
|
|
50
|
+
% if len(method.returns.parameters) > 0:
|
|
51
|
+
<% RSP_PARA = f'{intf.alias}_{method.name}_Rsp **rsp, ' %>\
|
|
52
|
+
% endif
|
|
53
|
+
% if len(method.parameters.parameters) > 0:
|
|
54
|
+
<% REQ_PARA = f'const {intf.alias}_{method.name}_Req *req, ' %>\
|
|
55
|
+
% endif
|
|
48
56
|
/*
|
|
49
57
|
* ${method.description}
|
|
50
58
|
*
|
|
@@ -56,8 +64,9 @@ gint ${class_name}_get_${prop.name}(const ${class_name} *object, GVariant **valu
|
|
|
56
64
|
* @out_${arg.name}: ${arg.description}, signature: ${arg.signature}
|
|
57
65
|
% endfor
|
|
58
66
|
*/
|
|
59
|
-
int ${class_name}_Call_${method.name}(const ${class_name} *object,
|
|
60
|
-
${
|
|
67
|
+
int ${class_name}_Call_${method.name}(const ${class_name} *object,
|
|
68
|
+
${REQ_PARA}${RSP_PARA}gint timeout,
|
|
69
|
+
GError **error)
|
|
61
70
|
{
|
|
62
71
|
if (error == NULL) {
|
|
63
72
|
log_error("Emit method ${method.name} with parameter error, error is NULL");
|
|
@@ -67,6 +76,12 @@ int ${class_name}_Call_${method.name}(const ${class_name} *object, const ${intf.
|
|
|
67
76
|
*error = g_error_new(G_DBUS_ERROR, G_DBUS_ERROR_FAILED, "Call method ${method.name} with parameter error, object is NULL");
|
|
68
77
|
return -1;
|
|
69
78
|
}
|
|
79
|
+
% if len(method.returns.parameters) == 0:
|
|
80
|
+
void **rsp = NULL;
|
|
81
|
+
% endif
|
|
82
|
+
% if len(method.parameters.parameters) == 0:
|
|
83
|
+
void *req = NULL;
|
|
84
|
+
% endif
|
|
70
85
|
return gcl_impl.call_method((GclObject *)object, (const GclMethod *)&${method_processer}->${method.name},
|
|
71
86
|
(void *)req, (void **)rsp, timeout, error);
|
|
72
87
|
}
|
|
@@ -29,15 +29,23 @@ gint ${class_name}_get_${prop.name}(const ${class_name} *object, GVariant **valu
|
|
|
29
29
|
% endfor
|
|
30
30
|
|
|
31
31
|
% for method in intf.methods:
|
|
32
|
+
<% RSP_PARA = f'' %>\
|
|
33
|
+
<% REQ_PARA = f'' %>\
|
|
34
|
+
% if len(method.returns.parameters) > 0:
|
|
35
|
+
<% RSP_PARA = f'{intf.alias}_{method.name}_Rsp **rsp, ' %>\
|
|
36
|
+
% endif
|
|
37
|
+
% if len(method.parameters.parameters) > 0:
|
|
38
|
+
<% REQ_PARA = f'const {intf.alias}_{method.name}_Req *req, ' %>\
|
|
39
|
+
% endif
|
|
32
40
|
/* method.description */
|
|
33
41
|
% if method.deprecated:
|
|
34
42
|
__attribute__((__deprecated__)) int ${class_name}_Call_${method.name}(const ${class_name} *object,
|
|
35
|
-
|
|
36
|
-
|
|
43
|
+
${REQ_PARA}${RSP_PARA}gint timeout,
|
|
44
|
+
GError **error);
|
|
37
45
|
% else:
|
|
38
46
|
int ${class_name}_Call_${method.name}(const ${class_name} *object,
|
|
39
|
-
|
|
40
|
-
|
|
47
|
+
${REQ_PARA}${RSP_PARA}gint timeout,
|
|
48
|
+
GError **error);
|
|
41
49
|
% endif
|
|
42
50
|
% endfor
|
|
43
51
|
|
|
@@ -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
|
|
|
@@ -1028,16 +1029,30 @@ void ${class_name}_${action.name}_unregister(${class_name}_${action.name}_action
|
|
|
1028
1029
|
g_mutex_unlock(&_${class_name}_${action.name}_lock);
|
|
1029
1030
|
}
|
|
1030
1031
|
|
|
1031
|
-
|
|
1032
|
+
<% RSP_PARA = f'' %>\
|
|
1033
|
+
<% REQ_PARA = f'' %>\
|
|
1034
|
+
<% REQ_NAME = f'' %>\
|
|
1035
|
+
% if len(action.returns.parameters) > 0:
|
|
1036
|
+
<% RSP_PARA = f', {class_name}_{action.name}_Rsp **rsp' %>\
|
|
1037
|
+
% endif
|
|
1038
|
+
% if len(action.parameters.parameters) > 0:
|
|
1039
|
+
<% REQ_PARA = f', const {class_name}_{action.name}_Req *req' %>\
|
|
1040
|
+
<% REQ_NAME = f', req' %>\
|
|
1041
|
+
% endif
|
|
1042
|
+
int ${class_name}_${action.name}_run(const ${class_name} *object${REQ_PARA}${RSP_PARA})
|
|
1032
1043
|
{
|
|
1033
1044
|
gint result = 0;
|
|
1034
1045
|
g_mutex_lock(&_${class_name}_${action.name}_lock);
|
|
1035
1046
|
for (GSList *item = _${class_name}_${action.name}_actions; item; item = item->next) {
|
|
1047
|
+
_${class_name}_${action.name}_PluginAction *handler = (_${class_name}_${action.name}_PluginAction *)item->data;
|
|
1048
|
+
% if len(action.returns.parameters) > 0:
|
|
1036
1049
|
if (rsp && *rsp) {
|
|
1037
1050
|
${class_name}_${action.name}_Rsp_free(rsp);
|
|
1038
1051
|
}
|
|
1039
|
-
|
|
1040
|
-
|
|
1052
|
+
gint ret = handler->action(object${REQ_NAME}, rsp, handler->user_data);
|
|
1053
|
+
% else:
|
|
1054
|
+
gint ret = handler->action(object${REQ_NAME}, handler->user_data);
|
|
1055
|
+
% endif
|
|
1041
1056
|
if (ret != 0)
|
|
1042
1057
|
result = ret;
|
|
1043
1058
|
% if action.policy == "return_any_success":
|
|
@@ -1147,8 +1162,14 @@ static gboolean _validate_odf_prop_${prop.name}(yaml_document_t *doc, GHashTable
|
|
|
1147
1162
|
gsize len = prop->len;
|
|
1148
1163
|
yaml_node_t *node = g_hash_table_lookup(prop_table, "${prop.name}");
|
|
1149
1164
|
do {
|
|
1150
|
-
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
|
|
1151
1171
|
break;
|
|
1172
|
+
}
|
|
1152
1173
|
g_string_append(prop, ".${prop.name}");
|
|
1153
1174
|
% if "refobj" not in prop.flags:
|
|
1154
1175
|
if (validate_odf_as_ref_prop(doc, node, prop))
|
|
@@ -1183,13 +1204,14 @@ gboolean ${intf.name.replace(".", "_")}_validate_odf(yaml_document_t *doc, yaml_
|
|
|
1183
1204
|
"the node type of object %s is not a mapping, get %s", object_name, gcl_yaml_node_type_str(node->type)));
|
|
1184
1205
|
return FALSE;
|
|
1185
1206
|
}
|
|
1186
|
-
GString *prop = g_string_sized_new(128);
|
|
1207
|
+
cleanup_gstring GString *prop = g_string_sized_new(128);
|
|
1187
1208
|
g_string_printf(prop, "%s", object_name);
|
|
1188
1209
|
gboolean valid = TRUE;
|
|
1189
1210
|
GHashTable *prop_table = load_yaml_mapping_to_hash_table(doc, node);
|
|
1190
1211
|
% for prop in stru.values.parameters:
|
|
1191
1212
|
valid = _validate_odf_prop_${prop.name}(doc, prop_table, prop, error_list) && valid;
|
|
1192
1213
|
% endfor
|
|
1214
|
+
g_hash_table_destroy(prop_table);
|
|
1193
1215
|
return valid;
|
|
1194
1216
|
}
|
|
1195
1217
|
|
|
@@ -176,13 +176,21 @@ typedef struct {
|
|
|
176
176
|
|
|
177
177
|
% if len(intf.plugin.actions) > 0:
|
|
178
178
|
% for action in intf.plugin.actions:
|
|
179
|
-
|
|
179
|
+
<% RSP_PARA = f'' %>\
|
|
180
|
+
<% REQ_PARA = f'' %>\
|
|
181
|
+
% if len(action.returns.parameters) > 0:
|
|
182
|
+
<% RSP_PARA = f', {class_name}_{action.name}_Rsq **rsp' %>\
|
|
183
|
+
% endif
|
|
184
|
+
% if len(action.parameters.parameters) > 0:
|
|
185
|
+
<% REQ_PARA = f', const {class_name}_{action.name}_Req *req' %>\
|
|
186
|
+
% endif
|
|
187
|
+
typedef int (*${class_name}_${action.name}_action)(const ${class_name} *object${REQ_PARA}${RSP_PARA}, gpointer user_data);
|
|
180
188
|
|
|
181
189
|
/* Register a new plugin action, can't register repeated with same action and user_data */
|
|
182
190
|
int ${class_name}_${action.name}_register(const gchar *req_signature, const gchar *rsp_signature,
|
|
183
191
|
${class_name}_${action.name}_action action, gpointer user_data);
|
|
184
192
|
void ${class_name}_${action.name}_unregister(${class_name}_${action.name}_action action);
|
|
185
|
-
int ${class_name}_${action.name}_run(const ${class_name} *object
|
|
193
|
+
int ${class_name}_${action.name}_run(const ${class_name} *object${REQ_PARA}${RSP_PARA});
|
|
186
194
|
|
|
187
195
|
% endfor
|
|
188
196
|
% endif
|
|
@@ -213,12 +213,16 @@ void ${class_name}_set_${prop.name}(const ${class_name} *object,
|
|
|
213
213
|
* Signal: ${signal.name}
|
|
214
214
|
* ${signal.description}
|
|
215
215
|
*/
|
|
216
|
+
<% REQ_PARA = f'' %>\
|
|
217
|
+
% if len(signal.properties.parameters) > 0:
|
|
218
|
+
<% REQ_PARA = f'const {class_name}_{signal.name}_Msg *msg, ' %>\
|
|
219
|
+
% endif
|
|
216
220
|
% if signal.deprecated:
|
|
217
221
|
__attribute__((__deprecated__)) gboolean ${class_name}_${signal.name}_Signal(const ${class_name} *object,
|
|
218
|
-
const gchar *destination,
|
|
222
|
+
const gchar *destination, ${REQ_PARA}GError **error)
|
|
219
223
|
% else:
|
|
220
224
|
gboolean ${class_name}_${signal.name}_Signal(const ${class_name} *object, const gchar *destination,
|
|
221
|
-
|
|
225
|
+
${REQ_PARA}GError **error)
|
|
222
226
|
% endif
|
|
223
227
|
{
|
|
224
228
|
if (error == NULL) {
|
|
@@ -229,6 +233,9 @@ gboolean ${class_name}_${signal.name}_Signal(const ${class_name} *object, const
|
|
|
229
233
|
*error = g_error_new(G_DBUS_ERROR, G_DBUS_ERROR_FAILED, "Emit ${signal.name} with parameter error, object is NULL");
|
|
230
234
|
return FALSE;
|
|
231
235
|
}
|
|
236
|
+
% if len(signal.properties.parameters) == 0:
|
|
237
|
+
void *msg = NULL;
|
|
238
|
+
% endif
|
|
232
239
|
return gcl_impl.emit_signal((GclObject *)object, destination,
|
|
233
240
|
(const GclSignal *)&${signal_processer}->${signal.name}, msg, error);
|
|
234
241
|
}
|
|
@@ -265,9 +272,11 @@ static void _load_odf_as_prop_${prop.name}(yaml_document_t *doc, GHashTable *pro
|
|
|
265
272
|
flags = val->data.scalar.value;
|
|
266
273
|
}
|
|
267
274
|
val = g_hash_table_lookup(prop_table, "${prop.name}");
|
|
275
|
+
## validate接口在加载odf前完成属性是否必选校验,此处如果是必选属性一定存在
|
|
268
276
|
if (!val) {
|
|
269
277
|
if (flags) {
|
|
270
|
-
|
|
278
|
+
## 属性不存在时传入的value为空,需要开发者在回调函数中完成异常(有flags无属性值)处理
|
|
279
|
+
ref_loaded(obj, &${properties}.${prop.name}, doc, NULL, user_data, flags);
|
|
271
280
|
}
|
|
272
281
|
return;
|
|
273
282
|
}
|
|
@@ -26,7 +26,11 @@ void ${class_name}_set_${prop.name}(const ${class_name} *object,
|
|
|
26
26
|
/*
|
|
27
27
|
* ${signal.description}
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
% if len(signal.properties.parameters) > 0:
|
|
30
|
+
gboolean ${class_name}_${signal.name}_Signal(const ${class_name} *object, const gchar *destination, const ${class_name}_${signal.name}_Msg *msg, GError **error);
|
|
31
|
+
% else:
|
|
32
|
+
gboolean ${class_name}_${signal.name}_Signal(const ${class_name} *object, const gchar *destination, GError **error);
|
|
33
|
+
% endif
|
|
30
34
|
% endfor
|
|
31
35
|
|
|
32
36
|
#define ${class_name.upper()}_NAME "${intf.name}"
|
lbkit-0.5.7/lbkit/__init__.py
DELETED
|
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
|
|
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
|