Simplify generate_plugins_path.py script

This also fix an empty plugin name being prepended to the list.
This commit is contained in:
Xavier Claessens 2019-09-17 15:53:40 -04:00
parent 6dfcecb16a
commit 7cf00627be
2 changed files with 18 additions and 14 deletions

View file

@ -86,13 +86,11 @@ if build_system == 'windows'
subproject('win-nasm')
endif
pathsep = host_machine.system() == 'windows' ? ';' : ':'
subproject('orc', required: get_option('orc'))
subprojects_names = []
plugins_doc_caches = []
all_plugins = ''
all_plugins = []
foreach sp : subprojects
project_name = sp[0]
build_infos = sp[1]
@ -114,10 +112,7 @@ foreach sp : subprojects
else
plugins = []
endif
foreach plugin: plugins
all_plugins += pathsep + plugin.full_path()
endforeach
all_plugins += plugins
subprojects_names += [project_name]
cmdres = run_command(python3, '-c', symlink.format(project_name, meson.current_source_dir()))
@ -170,9 +165,18 @@ else
endif
endif
cmdres = run_command(python3, find_program('scripts/generate_plugins_path.py'), '--builddir',
meson.build_root(), all_plugins)
assert(cmdres.returncode() == 0, 'Could not create plugins path: @0@'.format(cmdres.stderr()))
all_plugins_paths = []
foreach plugin: all_plugins
all_plugins_paths += plugin.full_path()
endforeach
generate_plugins_paths = find_program('scripts/generate_plugins_path.py')
configure_file(
output : 'GstPluginsPath.json',
command : [generate_plugins_paths,
'@OUTPUT@',
all_plugins_paths]
)
message('Building subprojects: ' + ', '.join(subprojects_names))
setenv = find_program('gst-env.py')

View file

@ -6,14 +6,14 @@ import json
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--builddir", help="The meson build directory")
parser.add_argument(dest="plugins", help="The list of plugins")
parser.add_argument(dest="output", help="Output file")
parser.add_argument(dest="plugins", nargs=argparse.REMAINDER, help="The list of plugins")
options = parser.parse_args()
all_paths = set()
for plugin in options.plugins.split(os.pathsep):
for plugin in options.plugins:
all_paths.add(os.path.dirname(plugin))
with open(os.path.join(options.builddir, 'GstPluginsPath.json'), "w") as f:
with open(options.output, "w") as f:
json.dump(list(all_paths), f, indent=4, sort_keys=True)