Commit 21428fea authored by Thibault Saunier's avatar Thibault Saunier

docs: Use the new GstPluginsPath.json to have the right plugin path

When inspecting plugins to generate the json cache file. Otherwise
when we are not in the uninstalled env and using `gst-build` plugins
with dependency might fail/throw warning, etc..
parent 71f39a78
Pipeline #36589 passed with stages
in 88 minutes and 48 seconds
......@@ -35,6 +35,7 @@ except ImportError: # python <3.3
# make it happen. For properties, the best way is to use th
# GST_PARAM_DOC_SHOW_DEFAULT flag.
UNSTABLE_VALUE = "unstable-values"
BUILD_ROOT = "@BUILD_ROOT@"
def dict_recursive_update(d, u):
......@@ -85,13 +86,31 @@ if __name__ == "__main__":
cmd.append(plugin_path)
gst_plugins_paths.append(os.path.dirname(plugin_path))
if subenv.get('GST_REGISTRY_UPDATE') != 'no' and len(cmd) >= 2:
data = subprocess.check_output(cmd, env=subenv)
try:
with open(os.path.join(BUILD_ROOT, 'GstPluginsPath.json')) as f:
plugin_paths = os.pathsep.join(json.load(f))
except FileNotFoundError:
plugin_paths = ""
if plugin_paths:
subenv['GST_PLUGIN_PATH'] = subenv.get('GST_PLUGIN_PATH', '') + ':' + plugin_paths
# Hide stderr unless an actual error happens as we have cases where we get g_warnings
# and other issues because plugins are being built while `gst_init` is called
stderrlogfile = output_filename + '.stderr'
with open(stderrlogfile, 'w') as log:
try:
plugins = json.loads(data.decode(), object_pairs_hook=OrderedDict)
except json.decoder.JSONDecodeError:
print("Could not decode:\n%s" % data.decode(), file=sys.stderr)
data = subprocess.check_output(cmd, env=subenv, stderr=log)
except subprocess.CalledProcessError as e:
log.flush()
with open(stderrlogfile, 'r') as f:
print(f.read(), file=sys.stderr)
raise
try:
plugins = json.loads(data.decode(), object_pairs_hook=OrderedDict)
except json.decoder.JSONDecodeError:
print("Could not decode:\n%s" % data.decode(), file=sys.stderr)
raise
new_cache = dict_recursive_update(cache, plugins)
......
......@@ -18,11 +18,16 @@ hotdoc_plugin_scanner = executable('gst-hotdoc-plugins-scanner',
install: true,
)
conf = configuration_data()
# We pass the build root so the doc cache generator can try
# to find GstPluginsPath.json to set GST_PLUGIN_PATH and
# thus handle plugins dependencies.
conf.set('BUILD_ROOT', meson.build_root())
configure_file(
input: 'gst-plugins-doc-cache-generator.py',
output: 'gst-plugins-doc-cache-generator',
copy: true,
install_dir : helpers_install_dir,
install_dir: helpers_install_dir,
configuration: conf
)
plugins_cache_generator = find_program(join_paths(meson.current_build_dir(), 'gst-plugins-doc-cache-generator'))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment