mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-05 06:58:49 +00:00
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.
This commit is contained in:
parent
6f33955af4
commit
a9bcc8f0ee
1 changed files with 36 additions and 19 deletions
|
@ -26,6 +26,22 @@ if not os.path.exists(DEFAULT_BUILDDIR):
|
||||||
DEFAULT_BUILDDIR = os.path.join(SCRIPTDIR, '_build')
|
DEFAULT_BUILDDIR = os.path.join(SCRIPTDIR, '_build')
|
||||||
|
|
||||||
|
|
||||||
|
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):
|
def prepend_env_var(env, var, value):
|
||||||
env[var] = os.pathsep + value + os.pathsep + env.get(var, "")
|
env[var] = os.pathsep + value + os.pathsep + env.get(var, "")
|
||||||
env[var] = env[var].replace(os.pathsep + os.pathsep, os.pathsep).strip(os.pathsep)
|
env[var] = env[var].replace(os.pathsep + os.pathsep, os.pathsep).strip(os.pathsep)
|
||||||
|
@ -83,7 +99,8 @@ def get_subprocess_env(options, gst_version):
|
||||||
mono_paths = set()
|
mono_paths = set()
|
||||||
srcdir_path = pathlib.Path(options.srcdir)
|
srcdir_path = pathlib.Path(options.srcdir)
|
||||||
for target in targets:
|
for target in targets:
|
||||||
filename = target['filename']
|
filenames = listify(target['filename'])
|
||||||
|
for filename in filenames:
|
||||||
root = os.path.dirname(filename)
|
root = os.path.dirname(filename)
|
||||||
if srcdir_path / "subprojects/gst-devtools/validate/plugins" in (srcdir_path / root).parents:
|
if srcdir_path / "subprojects/gst-devtools/validate/plugins" in (srcdir_path / root).parents:
|
||||||
continue
|
continue
|
||||||
|
@ -93,16 +110,16 @@ def get_subprocess_env(options, gst_version):
|
||||||
prepend_env_var(env, "GI_TYPELIB_PATH",
|
prepend_env_var(env, "GI_TYPELIB_PATH",
|
||||||
os.path.join(options.builddir, root))
|
os.path.join(options.builddir, root))
|
||||||
elif sharedlib_reg.search(filename):
|
elif sharedlib_reg.search(filename):
|
||||||
if target.get('type') != "shared library":
|
if not target['type'].startswith('shared'):
|
||||||
continue
|
continue
|
||||||
|
if target['installed']:
|
||||||
if target.get('installed') and pluginpath_reg.search(os.path.normpath(target.get('install_filename'))):
|
if pluginpath_reg.search(os.path.normpath(stringify(target['install_filename']))):
|
||||||
prepend_env_var(env, "GST_PLUGIN_PATH", os.path.join(options.builddir, root))
|
prepend_env_var(env, "GST_PLUGIN_PATH", os.path.join(options.builddir, root))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
prepend_env_var(env, lib_path_envvar,
|
prepend_env_var(env, lib_path_envvar,
|
||||||
os.path.join(options.builddir, root))
|
os.path.join(options.builddir, root))
|
||||||
elif target.get('type') == 'executable' and target.get('installed'):
|
elif target['type'] == 'executable' and target['installed']:
|
||||||
paths.add(os.path.join(options.builddir, root))
|
paths.add(os.path.join(options.builddir, root))
|
||||||
|
|
||||||
for p in paths:
|
for p in paths:
|
||||||
|
|
Loading…
Reference in a new issue