lbkit 0.9.10__tar.gz → 0.9.11__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 (79) hide show
  1. {lbkit-0.9.10/lbkit.egg-info → lbkit-0.9.11}/PKG-INFO +2 -3
  2. lbkit-0.9.11/lbkit/__commit__.py +1 -0
  3. lbkit-0.9.11/lbkit/__init__.py +2 -0
  4. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/build_conan_parallel.py +6 -0
  5. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/cli.py +30 -16
  6. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/codegen/codegen.py +6 -0
  7. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/codegen/ctype_defination.py +6 -0
  8. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/codegen/idf_interface.py +6 -0
  9. lbkit-0.9.11/lbkit/codegen/renderer.py +15 -0
  10. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/codegen/template/client.c.mako +16 -41
  11. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/codegen/template/client.h.mako +187 -7
  12. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/codegen/template/interface.introspect.xml.mako +7 -0
  13. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/codegen/template/public.c.mako +208 -16
  14. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/codegen/template/public.h.mako +17 -5
  15. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/codegen/template/server.c.mako +96 -84
  16. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/codegen/template/server.h.mako +123 -18
  17. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/component/arg_parser.py +6 -0
  18. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/component/build.py +10 -4
  19. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/component/template/conanbase.mako +20 -0
  20. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/component/template/deploy.mako +1 -1
  21. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/component/test.py +8 -2
  22. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/download_cache.py +6 -0
  23. lbkit-0.9.11/lbkit/errors.py +60 -0
  24. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/helper.py +17 -10
  25. lbkit-0.9.11/lbkit/lbkit.py +17 -0
  26. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/log.py +6 -0
  27. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/misc.py +6 -0
  28. lbkit-0.9.11/lbkit/skill/__init__.py +10 -0
  29. lbkit-0.9.11/lbkit/skill/constants.py +27 -0
  30. lbkit-0.9.11/lbkit/skill/manager.py +119 -0
  31. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/tasks/config.py +6 -0
  32. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/tasks/executor.py +27 -7
  33. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/tasks/image_maker/make_image.py +6 -0
  34. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/tasks/image_maker/make_qemu_image.py +6 -0
  35. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/tasks/image_maker/make_rockchip_image.py +6 -0
  36. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/tasks/task.py +6 -0
  37. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/tasks/task_build_image.py +6 -0
  38. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/tasks/task_build_manifest.py +8 -1
  39. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/tasks/task_build_prepare.py +6 -0
  40. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/tasks/task_build_rootfs.py +60 -25
  41. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/tasks/task_download.py +6 -0
  42. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/tools.py +15 -11
  43. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/ukr/build.py +6 -0
  44. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/utils/env_detector.py +6 -0
  45. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/utils/fakeroot.py +6 -0
  46. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/utils/images/emmc.py +6 -0
  47. {lbkit-0.9.10 → lbkit-0.9.11/lbkit.egg-info}/PKG-INFO +2 -3
  48. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit.egg-info/SOURCES.txt +7 -3
  49. {lbkit-0.9.10 → lbkit-0.9.11}/setup.py +8 -2
  50. {lbkit-0.9.10 → lbkit-0.9.11}/test/test_codegen.py +33 -35
  51. {lbkit-0.9.10 → lbkit-0.9.11}/test/test_config.py +6 -0
  52. {lbkit-0.9.10 → lbkit-0.9.11}/test/test_helper.py +6 -0
  53. lbkit-0.9.11/test/test_permission.py +340 -0
  54. lbkit-0.9.11/test/test_skill.py +172 -0
  55. lbkit-0.9.10/LICENSE +0 -202
  56. lbkit-0.9.10/lbkit/__init__.py +0 -2
  57. lbkit-0.9.10/lbkit/codegen/renderer.py +0 -9
  58. lbkit-0.9.10/lbkit/codegen/template/interface.c.mako +0 -0
  59. lbkit-0.9.10/lbkit/errors.py +0 -92
  60. lbkit-0.9.10/lbkit/lbkit.py +0 -11
  61. {lbkit-0.9.10 → lbkit-0.9.11}/AUTHORS +0 -0
  62. {lbkit-0.9.10 → lbkit-0.9.11}/MANIFEST.in +0 -0
  63. {lbkit-0.9.10 → lbkit-0.9.11}/README.md +0 -0
  64. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/ci_robot/__init__.py +0 -0
  65. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/codegen/__init__.py +0 -0
  66. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/component/__init__.py +0 -0
  67. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/tasks/__init__.py +0 -0
  68. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/tasks/image_maker/__init__.py +0 -0
  69. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/tasks/template/conanfile.py.mako +0 -0
  70. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/tasks/template/rootfs.py.mako +0 -0
  71. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/ukr/__init__.py +0 -0
  72. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/utils/__init__.py +0 -0
  73. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit/utils/images/__init__.py +0 -0
  74. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit.egg-info/dependency_links.txt +0 -0
  75. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit.egg-info/entry_points.txt +0 -0
  76. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit.egg-info/requires.txt +0 -0
  77. {lbkit-0.9.10 → lbkit-0.9.11}/lbkit.egg-info/top_level.txt +0 -0
  78. {lbkit-0.9.10 → lbkit-0.9.11}/setup.cfg +0 -0
  79. {lbkit-0.9.10 → lbkit-0.9.11}/test/__init__.py +0 -0
@@ -1,15 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lbkit
3
- Version: 0.9.10
3
+ Version: 0.9.11
4
4
  Summary: Tools provided by litebmc.com
5
5
  Home-page: https://www.litebmc.com
6
6
  Author: xuhj@litebmc.com
7
7
  Author-email: xuhj@litebmc.com
8
8
  Classifier: Programming Language :: Python :: 3
9
- Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
10
10
  Classifier: Operating System :: OS Independent
11
11
  Description-Content-Type: text/markdown
12
- License-File: LICENSE
13
12
  License-File: AUTHORS
14
13
  Requires-Dist: pyyaml
15
14
  Requires-Dist: colorama
@@ -0,0 +1 @@
1
+ __commit__ = '1f8eb04'
@@ -0,0 +1,2 @@
1
+
2
+ __version__ = '0.9.11'
@@ -1,3 +1,9 @@
1
+ # Copyright (c) 2021-2024 litebmc.com
2
+ #
3
+ # This program is free software; you can redistribute it and/or modify it
4
+ # under the terms of the GNU General Public License as published by the
5
+ # Free Software Foundation; either version 3 of the License, or (at your
6
+ # option) any later version.
1
7
  """任务基础类"""
2
8
  import os
3
9
  import json
@@ -1,3 +1,9 @@
1
+ # Copyright (c) 2021-2024 litebmc.com
2
+ #
3
+ # This program is free software; you can redistribute it and/or modify it
4
+ # under the terms of the GNU General Public License as published by the
5
+ # Free Software Foundation; either version 3 of the License, or (at your
6
+ # option) any later version.
1
7
  """lbkit命令行入口"""
2
8
  import inspect
3
9
  import os
@@ -6,6 +12,10 @@ import sys
6
12
  import argparse
7
13
  import traceback
8
14
  from lbkit import __version__ as client_version
15
+ try:
16
+ from lbkit.__commit__ import __commit__ as client_commit
17
+ except ImportError:
18
+ client_commit = ""
9
19
  from lbkit.codegen.codegen import CodeGen
10
20
  from lbkit.component.build import BuildComponent
11
21
  from lbkit.component.test import TestComponent
@@ -16,6 +26,7 @@ from lbkit import misc
16
26
  from lbkit import errors
17
27
  from lbkit.ukr.build import UKRBuild
18
28
  from lbkit.utils.env_detector import EnvDetector
29
+ from lbkit.skill.manager import sync as skill_sync
19
30
 
20
31
  log = Logger()
21
32
 
@@ -60,15 +71,6 @@ class Command(object):
60
71
  gen = CodeGen(argv)
61
72
  gen.run()
62
73
 
63
- # new package
64
- def new(self, *args):
65
- """
66
- 按LiteBmc最佳实践创建一个新的组件.
67
-
68
- 你需要指定你需要使用的编程语言,当前仅支持C(基于litebmc框架)和C++(基于openbmc的sdbusplus)
69
- """
70
- log.info("new package")
71
-
72
74
  # build package
73
75
  def build(self, *args):
74
76
  """
@@ -105,13 +107,22 @@ class Command(object):
105
107
  build = TestComponent(argv)
106
108
  build.run()
107
109
 
110
+ def skill(self, *args):
111
+ """
112
+ 同步AI技能包.
113
+
114
+ 从技能仓库下载并复制所有skills到用户全局技能库(~/.claude/skills)
115
+ """
116
+ skill_sync()
117
+
108
118
  def _show_help(self):
109
119
  """
110
120
  Prints a summary of all commands.
111
121
  """
112
122
  grps = [("Code Generate commands", ["gen"]),
113
- ("Build Component commands", ["new", "build", "test"]),
123
+ ("Build Component commands", ["build", "test"]),
114
124
  ("Build Product commands", ["build"]),
125
+ ("AI Skill commands", ["skill"]),
115
126
  ("Misc commands", ["help"]),
116
127
  ]
117
128
 
@@ -194,7 +205,10 @@ class Command(object):
194
205
  method = commands[command]
195
206
  except KeyError as exc:
196
207
  if command in ["-v", "--version"]:
197
- log.info("LiteBmc version %s" % client_version)
208
+ ver = f"LiteBmc version {client_version}"
209
+ if client_commit:
210
+ ver += f" (commit {client_commit})"
211
+ log.info(ver)
198
212
  return False
199
213
 
200
214
  self._warn_python_version()
@@ -215,17 +229,17 @@ class Command(object):
215
229
  if exc.code != 0:
216
230
  log.error("Exiting with code: %d" % exc.code)
217
231
  ret_code = exc.code
218
- except (errors.LiteBmcException, errors.RunCommandException, errors.ArgException, errors.PackageConfigException, Exception, errors.OdfValidateException) as exc:
232
+ except errors.TestException as exc:
233
+ log.error("lbk exit with exception:")
234
+ log.error(exc)
235
+ ret_code = -1
236
+ except Exception as exc:
219
237
  log.error("lbk exit with exception:")
220
238
  if os.environ.get("LOG"):
221
239
  print(traceback.format_exc())
222
240
  ret_code = -1
223
241
  msg = str(exc)
224
242
  log.error(msg)
225
- except errors.TestException:
226
- log.error("lbk exit with exception:")
227
- log.error(exc)
228
- ret_code = -1
229
243
 
230
244
  return ret_code
231
245
 
@@ -1,3 +1,9 @@
1
+ # Copyright (c) 2021-2024 litebmc.com
2
+ #
3
+ # This program is free software; you can redistribute it and/or modify it
4
+ # under the terms of the GNU General Public License as published by the
5
+ # Free Software Foundation; either version 3 of the License, or (at your
6
+ # option) any later version.
1
7
  """
2
8
  DBus接口代码自动生成
3
9
  """
@@ -1,3 +1,9 @@
1
+ # Copyright (c) 2021-2024 litebmc.com
2
+ #
3
+ # This program is free software; you can redistribute it and/or modify it
4
+ # under the terms of the GNU General Public License as published by the
5
+ # Free Software Foundation; either version 3 of the License, or (at your
6
+ # option) any later version.
1
7
  """语言相关类型定义"""
2
8
  import sys
3
9
  from lbkit.errors import OdfValidateException
@@ -1,3 +1,9 @@
1
+ # Copyright (c) 2021-2024 litebmc.com
2
+ #
3
+ # This program is free software; you can redistribute it and/or modify it
4
+ # under the terms of the GNU General Public License as published by the
5
+ # Free Software Foundation; either version 3 of the License, or (at your
6
+ # option) any later version.
1
7
  import os
2
8
  import re
3
9
  import copy
@@ -0,0 +1,15 @@
1
+ # Copyright (c) 2021-2024 litebmc.com
2
+ #
3
+ # This program is free software; you can redistribute it and/or modify it
4
+ # under the terms of the GNU General Public License as published by the
5
+ # Free Software Foundation; either version 3 of the License, or (at your
6
+ # option) any later version.
7
+ from mako.lookup import TemplateLookup
8
+
9
+ class Renderer(object):
10
+ def __init__(self):
11
+ super(Renderer, self).__init__()
12
+
13
+ def render(self, lookup: TemplateLookup, template, **kwargs):
14
+ t = lookup.get_template(template)
15
+ return t.render(lookup=lookup, **kwargs)
@@ -1,6 +1,21 @@
1
1
  <%
2
2
  from inflection import underscore
3
3
  %>\
4
+ /*
5
+ * Copyright (c) 2021-2024 litebmc.com
6
+ * Auto-generated by lbkit, DO NOT EDIT.
7
+ *
8
+ * This library is free software; you can redistribute it and/or modify it
9
+ * under the terms of the GNU Lesser General Public License as published by the
10
+ * Free Software Foundation; either version 2.1 of the License, or (at your
11
+ * option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful, but WITHOUT
14
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
16
+ * for more details.
17
+ **/
18
+
4
19
  #include "lb_base.h"
5
20
  #include "${intf.alias}.h"
6
21
 
@@ -31,46 +46,6 @@ gint ${class_name}_set_${prop.name}(${class_name} obj,
31
46
  return lb_impl.write_property((LBO *)obj, &${properties}.${prop.name}, tmp, error);
32
47
  }
33
48
 
34
- % endif
35
- ## 私有或只写属性不允许读
36
- % if not prop.private and prop.access != "write":
37
- % if prop.deprecated:
38
- __deprecated gint ${class_name}_get_${prop.name}(${class_name} obj,
39
- ${", ".join(prop.out_declare()).replace("<arg_name>", "value").replace("<const>", "")}, GError **error)
40
- % else:
41
- gint ${class_name}_get_${prop.name}(${class_name} obj, ${", ".join(prop.out_declare()).replace("<arg_name>", "value").replace("<const>", "")}, GError **error)
42
- % endif
43
- {
44
- % if "gsize n_" in prop.declare()[0]:
45
- g_assert(n_value && value);
46
- % else:
47
- g_assert(value);
48
- % endif
49
- % for line in prop.declare():
50
- % if "*" in line:
51
- ${line.strip().replace("<arg_name>", "tmp_value").replace("<const>", "")} = NULL;
52
- % else:
53
- ${line.strip().replace("<arg_name>", "tmp_value").replace("<const>", "")};
54
- % endif
55
- % endfor
56
- GVariant *out = NULL;
57
-
58
- gint ret = lb_impl.read_property((LBO *)obj, &${properties}.${prop.name}, &out, error);
59
- if (ret == 0 && out) {
60
- % for line in prop.decode_func():
61
- ${line.replace("<arg_in>", "tmp_value").replace("<arg_name>", "out")};
62
- % endfor
63
- *value = tmp_value;
64
- % if "gsize n_" in prop.declare()[0]:
65
- *n_value = n_tmp_value;
66
- % endif
67
- }
68
- if (out) {
69
- g_variant_unref(out);
70
- }
71
- return ret;
72
- }
73
-
74
49
  % endif
75
50
  % endfor
76
51
 
@@ -155,7 +130,7 @@ static void _${class_name}_destroy(LBO *obj)
155
130
  */
156
131
  static LBO *_${class_name}_create(const gchar *name, gpointer opaque)
157
132
  {
158
- struct _${intf.alias} *obj = g_new0(struct _${intf.alias}, 1);
133
+ struct _${intf.alias} *obj = g_malloc0(sizeof(struct _${intf.alias}) + sizeof(GVariant *) * ${intf.alias}_PROP_COUNT);
159
134
  memcpy(obj->_base.magic, LB_MAGIC, strlen(LB_MAGIC) + 1);
160
135
  obj->_base.lock = g_new0(GRecMutex, 1);
161
136
  g_rec_mutex_init(obj->_base.lock);
@@ -1,4 +1,19 @@
1
1
  <% from lbkit.tools import hump2underline %>\
2
+ /*
3
+ * Copyright (c) 2021-2024 litebmc.com
4
+ * Auto-generated by lbkit, DO NOT EDIT.
5
+ *
6
+ * This library is free software; you can redistribute it and/or modify it
7
+ * under the terms of the GNU Lesser General Public License as published by the
8
+ * Free Software Foundation; either version 2.1 of the License, or (at your
9
+ * option) any later version.
10
+ *
11
+ * This library is distributed in the hope that it will be useful, but WITHOUT
12
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
14
+ * for more details.
15
+ **/
16
+
2
17
  #ifndef __${"_".join(intf.name.upper().split(".", -1))}_CLI_H__
3
18
  #define __${"_".join(intf.name.upper().split(".", -1))}_CLI_H__
4
19
 
@@ -35,13 +50,6 @@ __deprecated gint ${class_name}_set_${prop.name}(${class_name} obj, ${", ".join(
35
50
  gint ${class_name}_set_${prop.name}(${class_name} obj, ${", ".join(prop.declare()).replace("<arg_name>", "value").replace("<const>", "const ")}, GError **error);
36
51
  % endif
37
52
  % endif
38
- % if not prop.private and prop.access != "write":
39
- % if prop.deprecated:
40
- __deprecated gint ${class_name}_get_${prop.name}(${class_name} obj, ${", ".join(prop.out_declare()).replace("<arg_name>", "value").replace("<const>", "")}, GError **error);
41
- % else:
42
- gint ${class_name}_get_${prop.name}(${class_name} obj, ${", ".join(prop.out_declare()).replace("<arg_name>", "value").replace("<const>", "")}, GError **error);
43
- % endif
44
- % endif
45
53
  % endif
46
54
  % endfor
47
55
 
@@ -189,6 +197,178 @@ static inline void _cleanup_${class_name}_list(GSList **ptr)
189
197
 
190
198
  #define cleanup_${class_name} __attribute__((cleanup(_cleanup_${class_name}_)))
191
199
  #define cleanup_${class_name}_list __attribute__((cleanup(_cleanup_${class_name}_list)))
200
+ <%!
201
+ import re
202
+
203
+ def out_decl_to_local_var(decl):
204
+ s = decl.replace("<const>", "").replace("<arg_name>", "value").strip()
205
+ if '***' in s:
206
+ s = s.replace('***', '**', 1)
207
+ elif '**' in s:
208
+ s = s.replace('**', '*', 1)
209
+ elif ' *' in s:
210
+ s = s.replace(' *', ' ', 1)
211
+ return s.strip()
212
+
213
+ def out_decl_to_type(decl):
214
+ local = out_decl_to_local_var(decl)
215
+ if local.endswith("value"):
216
+ prefix = local[:-5]
217
+ if prefix.endswith("n_"):
218
+ return prefix[:-2].strip()
219
+ return prefix.rstrip() if prefix.endswith(' ') else prefix
220
+ return local
221
+
222
+ def is_count_param(decl):
223
+ return "n_<arg_name>" in decl
224
+
225
+ def out_decl_to_ptr_param(decl):
226
+ return decl.replace("<const>", "").replace("<arg_name>", "value_ptr")
227
+
228
+ def is_ptr_local(decl):
229
+ s = out_decl_to_local_var(decl)
230
+ return '*' in s
231
+
232
+ def get_cleanup_attr(prop):
233
+ free_lines = prop.free_func()
234
+ if not free_lines:
235
+ return None
236
+ free_str = " ".join(free_lines)
237
+ if "lb_strfreev_p" in free_str:
238
+ return "cleanup_strv"
239
+ elif "lb_unref_p" in free_str:
240
+ return "cleanup_unref"
241
+ elif "_free_v(&<arg_name>)" in free_str:
242
+ return None
243
+ elif "_free(&<arg_name>)" in free_str:
244
+ return None
245
+ elif "lb_free_p" in free_str:
246
+ return "cleanup_gpointer"
247
+ return None
248
+
249
+ def needs_custom_cleanup(prop):
250
+ free_lines = prop.free_func()
251
+ if not free_lines:
252
+ return False
253
+ free_str = " ".join(free_lines)
254
+ return "_free_v(&<arg_name>)" in free_str or "_free(&<arg_name>)" in free_str
255
+
256
+ def free_line_to_cleanup(line, ptr_name="value_ptr"):
257
+ return line.replace("<arg_name>", "(*%s)" % ptr_name)
258
+
259
+ _bs = chr(92)
260
+ %>\
261
+ % for prop in intf.properties:
262
+ % if not prop.private and prop.access != "write":
263
+ <%
264
+ out_decls_getter = prop.out_declare()
265
+ %>\
266
+ % if prop.deprecated:
267
+ __deprecated static inline gint _${class_name}_get_${prop.name}_val(${class_name} obj,
268
+ ${", ".join(out_decls_getter).replace("<arg_name>", "value").replace("<const>", "")}, GError **error)
269
+ % else:
270
+ static inline gint _${class_name}_get_${prop.name}_val(${class_name} obj, ${", ".join(out_decls_getter).replace("<arg_name>", "value").replace("<const>", "")}, GError **error)
271
+ % endif
272
+ {
273
+ % if "gsize n_" in prop.declare()[0]:
274
+ g_assert(n_value && value);
275
+ % else:
276
+ g_assert(value);
277
+ % endif
278
+ % for line in prop.declare():
279
+ % if "*" in line:
280
+ ${line.strip().replace("<arg_name>", "tmp_value").replace("<const>", "")} = NULL;
281
+ % else:
282
+ ${line.strip().replace("<arg_name>", "tmp_value").replace("<const>", "")};
283
+ % endif
284
+ % endfor
285
+ GVariant *out = NULL;
286
+ gint ret = lb_impl.read_property((LBO *)obj, &${class_name}_properties()->${prop.name}, &out, error);
287
+ if (ret == 0 && out) {
288
+ % for line in prop.decode_func():
289
+ ${line.replace("<arg_in>", "tmp_value").replace("<arg_name>", "out")};
290
+ % endfor
291
+ *value = tmp_value;
292
+ % if "gsize n_" in prop.declare()[0]:
293
+ *n_value = n_tmp_value;
294
+ % endif
295
+ }
296
+ if (out) {
297
+ g_variant_unref(out);
298
+ }
299
+ return ret;
300
+ }
301
+
302
+ % endif
303
+ % endfor
304
+
305
+ % for prop in intf.properties:
306
+ % if not prop.private and prop.access != "write":
307
+ static inline GVariant *_${class_name}_get_${prop.name}_variant(${class_name} obj)
308
+ {
309
+ g_assert(obj);
310
+ GVariant *out = NULL;
311
+ lb_impl.read_property((LBO *)obj, &${class_name}_properties()->${prop.name}, &out, NULL);
312
+ return out;
313
+ }
314
+
315
+ #define ${class_name}_get_${prop.name}(obj, _val) \
316
+ cleanup_unref GVariant *_val = _${class_name}_get_${prop.name}_variant(obj)
317
+ % endif
318
+ % endfor
319
+
320
+ % for prop in intf.properties:
321
+ % if not prop.private and prop.access != "write" and needs_custom_cleanup(prop):
322
+ <%
323
+ free_lines = prop.free_func()
324
+ out_decls = prop.out_declare()
325
+ %>\
326
+ static inline void _cleanup_${class_name}_get_${prop.name}_val(${", ".join([out_decl_to_ptr_param(d) for d in out_decls])})
327
+ {
328
+ % for line in free_lines:
329
+ ${free_line_to_cleanup(line)};
330
+ % endfor
331
+ }
332
+ % endif
333
+ % endfor
334
+ % for prop in intf.properties:
335
+ % if not prop.private and prop.access != "write":
336
+ <%
337
+ free_lines = prop.free_func()
338
+ out_decls = prop.out_declare()
339
+ has_cleanup = len(free_lines) > 0
340
+ cleanup_attr = get_cleanup_attr(prop)
341
+ custom_cleanup = needs_custom_cleanup(prop)
342
+ %>\
343
+ #define ${class_name}_get_${prop.name}_val(obj, _val, _err, _ret) ${_bs}
344
+ % for d in out_decls:
345
+ % if is_count_param(d):
346
+ ${out_decl_to_type(d)} n_##_val = 0; ${_bs}
347
+ % else:
348
+ % if is_ptr_local(d):
349
+ % if custom_cleanup:
350
+ __attribute__((cleanup(_cleanup_${class_name}_get_${prop.name}_val))) ${_bs}
351
+ % elif cleanup_attr:
352
+ ${cleanup_attr} ${_bs}
353
+ % endif
354
+ ${out_decl_to_type(d)} _val = NULL; ${_bs}
355
+ % else:
356
+ ${out_decl_to_type(d)} _val = 0; ${_bs}
357
+ % endif
358
+ % endif
359
+ % endfor
360
+ _ret = _${class_name}_get_${prop.name}_val(obj\
361
+ % for d in out_decls:
362
+ % if is_count_param(d):
363
+ , &n_##_val\
364
+ % else:
365
+ , &_val\
366
+ % endif
367
+ % endfor
368
+ , &_err)
369
+
370
+ % endif
371
+ % endfor
192
372
  #ifdef __cplusplus
193
373
  }
194
374
  #endif
@@ -1,3 +1,10 @@
1
+ <!-- Copyright (c) 2021-2024 litebmc.com -->
2
+ <!-- Auto-generated by lbkit, DO NOT EDIT. -->
3
+ <!-- This library is free software; you can redistribute it and/or modify it -->
4
+ <!-- under the terms of the GNU Lesser General Public License as published by the -->
5
+ <!-- Free Software Foundation; either version 2.1 of the License, or (at your -->
6
+ <!-- option) any later version. -->
7
+
1
8
  <!DOCTYPE node PUBLIC
2
9
  "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
3
10
  "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">