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..
This commit is contained in:
Thibault Saunier 2018-11-11 20:11:47 -03:00
parent 71f39a7836
commit 21428feac7
2 changed files with 31 additions and 7 deletions

View file

@ -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,8 +86,26 @@ 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:
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:

View file

@ -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,
configuration: conf
)
plugins_cache_generator = find_program(join_paths(meson.current_build_dir(), 'gst-plugins-doc-cache-generator'))