5 from string import Template
7 TEMPLATE = Template('''
13 gst_init_static_plugins (void)
19 if __name__ == "__main__":
20 parser = argparse.ArgumentParser()
21 parser.add_argument(dest="output", help="Output file")
22 parser.add_argument(dest="plugins", nargs=argparse.REMAINDER, help="The list of plugins")
24 options = parser.parse_args()
27 for plugin in options.plugins:
28 filename = os.path.basename(plugin)
29 if filename.startswith('libgst') and filename.endswith('.a'):
30 names.add(filename[len('libgst'):-len('.a')])
32 registration = ['GST_PLUGIN_STATIC_REGISTER(%s);' % name for name in names]
33 declaration = ['GST_PLUGIN_STATIC_DECLARE(%s);' % name for name in names]
35 with open(options.output, "w") as f:
36 f.write(TEMPLATE.substitute({
37 'plugins_declaration': '\n'.join(declaration),
38 'plugins_registration': '\n '.join(registration),