mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-22 09:41:07 +00:00
gstreamer-full-static: autopep on script
Pass autopep on generate_init_static_plugins.py Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1637>
This commit is contained in:
parent
a997108b18
commit
802c8674d4
1 changed files with 21 additions and 11 deletions
32
scripts/generate_init_static_plugins.py
Normal file → Executable file
32
scripts/generate_init_static_plugins.py
Normal file → Executable file
|
@ -28,6 +28,8 @@ gst_init_static_plugins (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
''')
|
''')
|
||||||
|
|
||||||
|
|
||||||
# Retrieve the plugin name as it can be a plugin filename
|
# Retrieve the plugin name as it can be a plugin filename
|
||||||
def get_plugin_name(name):
|
def get_plugin_name(name):
|
||||||
for p in plugins:
|
for p in plugins:
|
||||||
|
@ -35,12 +37,13 @@ def get_plugin_name(name):
|
||||||
return p
|
return p
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
||||||
def process_features(features_list, plugins, feature_prefix):
|
def process_features(features_list, plugins, feature_prefix):
|
||||||
plugins_list = plugins
|
plugins_list = plugins
|
||||||
feature_declaration = []
|
feature_declaration = []
|
||||||
feature_registration = []
|
feature_registration = []
|
||||||
if features_list is not None:
|
if features_list is not None:
|
||||||
feature_plugins = features_list.split(';')
|
feature_plugins = features_list.split(';')
|
||||||
for plugin in feature_plugins:
|
for plugin in feature_plugins:
|
||||||
split = plugin.split(':')
|
split = plugin.split(':')
|
||||||
plugin_name = split[0].strip()
|
plugin_name = split[0].strip()
|
||||||
|
@ -54,20 +57,24 @@ def process_features(features_list, plugins, feature_prefix):
|
||||||
feature_registration += ['%s_REGISTER(%s, NULL);' % (feature_prefix, feature)]
|
feature_registration += ['%s_REGISTER(%s, NULL);' % (feature_prefix, feature)]
|
||||||
return (plugins_list, feature_declaration, feature_registration)
|
return (plugins_list, feature_declaration, feature_registration)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('-o', dest="output", help="Output file")
|
parser.add_argument('-o', dest="output", help="Output file")
|
||||||
parser.add_argument('-p','--plugins', nargs='?', default='', dest="plugins", help="The list of plugins")
|
parser.add_argument('-p', '--plugins', nargs='?', default='', dest="plugins", help="The list of plugins")
|
||||||
parser.add_argument('-e', '--elements', nargs='?', default='', dest="elements", help="The list of plugin:elements")
|
parser.add_argument('-e', '--elements', nargs='?', default='', dest="elements", help="The list of plugin:elements")
|
||||||
parser.add_argument('-t', '--type-finds', nargs='?', default='', dest="typefindfuncs", help="The list of plugin:typefinds")
|
parser.add_argument('-t', '--type-finds', nargs='?', default='',
|
||||||
parser.add_argument('-d', '--devide-providers', nargs='?', default='', dest="deviceproviders", help="The list of plugin:deviceproviders")
|
dest="typefindfuncs", help="The list of plugin:typefinds")
|
||||||
parser.add_argument('-T', '--dynamic-types', nargs='?', default='', dest="dynamictypes", help="The list of plugin:dynamictypes")
|
parser.add_argument('-d', '--devide-providers', nargs='?', default='',
|
||||||
|
dest="deviceproviders", help="The list of plugin:deviceproviders")
|
||||||
|
parser.add_argument('-T', '--dynamic-types', nargs='?', default='',
|
||||||
|
dest="dynamictypes", help="The list of plugin:dynamictypes")
|
||||||
options = parser.parse_args()
|
options = parser.parse_args()
|
||||||
if options.output is None:
|
if options.output is None:
|
||||||
output_file = 'gstinitstaticplugins.c'
|
output_file = 'gstinitstaticplugins.c'
|
||||||
else:
|
else:
|
||||||
output_file = options.output
|
output_file = options.output
|
||||||
enable_staticelements_plugin = 0;
|
enable_staticelements_plugin = 0
|
||||||
elements_declaration = []
|
elements_declaration = []
|
||||||
elements_registration = []
|
elements_registration = []
|
||||||
typefind_funcs_declaration = []
|
typefind_funcs_declaration = []
|
||||||
|
@ -90,16 +97,19 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
# process the features
|
# process the features
|
||||||
(plugins, elements_declaration, elements_registration) = process_features(options.elements, plugins, 'GST_ELEMENT')
|
(plugins, elements_declaration, elements_registration) = process_features(options.elements, plugins, 'GST_ELEMENT')
|
||||||
(plugins, typefind_funcs_declaration, typefind_funcs_registration) = process_features(options.typefindfuncs, plugins, 'GST_TYPE_FIND')
|
(plugins, typefind_funcs_declaration, typefind_funcs_registration) = process_features(
|
||||||
(plugins, device_providers_declaration, device_providers_registration) = process_features(options.deviceproviders, plugins, 'GST_DEVICE_PROVIDER')
|
options.typefindfuncs, plugins, 'GST_TYPE_FIND')
|
||||||
(plugins, dynamic_types_declaration, dynamic_types_registration) = process_features(options.dynamictypes, plugins, 'GST_DYNAMIC_TYPE')
|
(plugins, device_providers_declaration, device_providers_registration) = process_features(
|
||||||
|
options.deviceproviders, plugins, 'GST_DEVICE_PROVIDER')
|
||||||
|
(plugins, dynamic_types_declaration, dynamic_types_registration) = process_features(
|
||||||
|
options.dynamictypes, plugins, 'GST_DYNAMIC_TYPE')
|
||||||
|
|
||||||
# Enable plugin or elements according to the ';' separated list.
|
# Enable plugin or elements according to the ';' separated list.
|
||||||
for plugin in plugins:
|
for plugin in plugins:
|
||||||
split = plugin.split(':')
|
split = plugin.split(':')
|
||||||
plugin_name = split[0]
|
plugin_name = split[0]
|
||||||
if plugin_name == '':
|
if plugin_name == '':
|
||||||
continue
|
continue
|
||||||
filename = os.path.basename(plugin)
|
filename = os.path.basename(plugin)
|
||||||
if filename.startswith('libgst') and filename.endswith('.a'):
|
if filename.startswith('libgst') and filename.endswith('.a'):
|
||||||
plugin_name = filename[len('libgst'):-len('.a')]
|
plugin_name = filename[len('libgst'):-len('.a')]
|
||||||
|
@ -119,4 +129,4 @@ if __name__ == "__main__":
|
||||||
'dynamic_types_registration': '\n '.join(dynamic_types_registration),
|
'dynamic_types_registration': '\n '.join(dynamic_types_registration),
|
||||||
'plugins_declaration': '\n'.join(plugins_declaration),
|
'plugins_declaration': '\n'.join(plugins_declaration),
|
||||||
'plugins_registration': '\n '.join(plugins_registration),
|
'plugins_registration': '\n '.join(plugins_registration),
|
||||||
}))
|
}))
|
||||||
|
|
Loading…
Reference in a new issue