Commit f922969a authored by Nirbheek Chauhan's avatar Nirbheek Chauhan 🐜

gst-uninstalled: Fix compatibility with meson 0.50

Starting with Meson 0.50, meson instrospect --targets uses a list
for the filename and install_filenames of each target. Handle both
lists and strings.
parent 8c7727a9
......@@ -19,6 +19,22 @@ SCRIPTDIR = os.path.dirname(os.path.realpath(__file__))
PREFIX_DIR = os.path.join(SCRIPTDIR, 'prefix')
def listify(o):
if isinstance(o, str):
return [o]
if isinstance(o, list):
return o
raise AssertionError('Object {!r} must be a string or a list'.format(o))
def stringify(o):
if isinstance(o, str):
return o
if isinstance(o, list):
if len(o) == 1:
return o[0]
raise AssertionError('Did not expect object {!r} to have more than one element'.format(o))
raise AssertionError('Object {!r} must be a string or a list'.format(o))
def prepend_env_var(env, var, value):
env[var] = os.pathsep + value + os.pathsep + env.get(var, "")
env[var] = env[var].replace(os.pathsep + os.pathsep, os.pathsep).strip(os.pathsep)
......@@ -75,27 +91,28 @@ def get_subprocess_env(options):
mono_paths = set()
srcdir_path = pathlib.Path(options.srcdir)
for target in targets:
filename = target['filename']
root = os.path.dirname(filename)
if srcdir_path / "subprojects/gst-devtools/validate/plugins" in (srcdir_path / root).parents:
continue
if filename.endswith('.dll'):
mono_paths.add(os.path.join(options.builddir, root))
if typelib_reg.search(filename):
prepend_env_var(env, "GI_TYPELIB_PATH",
os.path.join(options.builddir, root))
elif sharedlib_reg.search(filename):
if target.get('type') != "shared library":
continue
if target.get('installed') and pluginpath_reg.search(os.path.normpath(target.get('install_filename'))):
prepend_env_var(env, "GST_PLUGIN_PATH", os.path.join(options.builddir, root))
filenames = listify(target['filename'])
for filename in filenames:
root = os.path.dirname(filename)
if srcdir_path / "subprojects/gst-devtools/validate/plugins" in (srcdir_path / root).parents:
continue
prepend_env_var(env, lib_path_envvar,
os.path.join(options.builddir, root))
elif target.get('type') == 'executable' and target.get('installed'):
paths.add(os.path.join(options.builddir, root))
if filename.endswith('.dll'):
mono_paths.add(os.path.join(options.builddir, root))
if typelib_reg.search(filename):
prepend_env_var(env, "GI_TYPELIB_PATH",
os.path.join(options.builddir, root))
elif sharedlib_reg.search(filename):
if not target['type'].startswith('shared'):
continue
if target['installed']:
if pluginpath_reg.search(os.path.normpath(stringify(target['install_filename']))):
prepend_env_var(env, "GST_PLUGIN_PATH", os.path.join(options.builddir, root))
continue
prepend_env_var(env, lib_path_envvar,
os.path.join(options.builddir, root))
elif target['type'] == 'executable' and target['installed']:
paths.add(os.path.join(options.builddir, root))
for p in paths:
prepend_env_var(env, 'PATH', p)
......
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