adctk python hello world without hard-coded publisher choices.
48def main() -> int:
49 """!
50 @brief adctk python hello world without hard-coded publisher choices.
51 """
52
53
55 avail = f.get_publisher_names()
56 print(f"available publishers are: {avail}")
57 print(f'ADC_MULTI_PUBLISHER_NAMES is: {os.getenv("ADC_MULTI_PUBLISHER_NAMES")}')
58
59
60 b = f.get_builder()
61 b.add_header_section("cxx_demo_1")
62
63
64 app_data = f.get_builder()
65 app_data.add("hello", "world")
66 img = get_png_mime()
67 app_data.add_mime("grid1", "image/png", "base64", "test.png", img)
68 b.add_app_data_section(app_data)
69
70
71 b.add_host_section(all_hs=True)
72
73
74
75 print(f'adc pub version: {adctk.Publisher.API_VERSION["version"]}' )
76 print(f'adc builder version: {adctk.Builder.API_VERSION["version"]}' )
77
78
79
80 mp = f.get_multi_publisher(strict=True, plugins=[])
81
82
83 err = mp.publish(b)
84 if err:
85 print(f"got {err} publication errors." )
86
87
88
89
90 b.add_exit_data_section(0, "all good in python", None)
91 b.add_header_section("cxx_demo_1")
92 err = mp.publish(b)
93 if err:
94 print(f"got {err} publication errors." )
95
96
97 mp.terminate()
98
99
100
101 if False:
102
103
104
105
106 path = os.getenv("ADC_MULTIFILE_PLUGIN_DIRECTORY")
107 wfid = os.getenv("ADC_WFID")
108
109
110 old_paths = []
111
112 new_files = []
113 if len(old_paths):
114 for i in old_paths:
115 print(f"consolidating from: {i}")
116 if False:
117 try:
118 os.remove(i)
119 except FileNotFoundError:
120 pass
121 for i in new_files:
122 print(f"consolidated to: {i}" )
123 else:
124 print("no consolidation done.")
125
126 return 0
127
128
129
130
factory for adctk api objects.
Definition factory.py:34