mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-29 05:01:23 +00:00
gst-env: Don't put helper binaries in PATH
Check if the executable would be installed into bindir before adding it to PATH in the uninstalled shell. Fixes https://gitlab.freedesktop.org/gstreamer/gst-build/issues/67
This commit is contained in:
parent
245baadbce
commit
bc1c337c77
1 changed files with 26 additions and 3 deletions
29
gst-env.py
29
gst-env.py
|
@ -13,6 +13,7 @@ import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import pathlib
|
import pathlib
|
||||||
import signal
|
import signal
|
||||||
|
from pathlib import PurePath
|
||||||
|
|
||||||
from distutils.sysconfig import get_python_lib
|
from distutils.sysconfig import get_python_lib
|
||||||
from distutils.util import strtobool
|
from distutils.util import strtobool
|
||||||
|
@ -96,6 +97,24 @@ def is_library_target_and_not_plugin(target, filename):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def is_binary_target_and_in_path(target, filename, bindir):
|
||||||
|
if target['type'] != 'executable':
|
||||||
|
return False
|
||||||
|
if not target['installed']:
|
||||||
|
return False
|
||||||
|
# Check if this file installed by this target is installed to bindir
|
||||||
|
for install_filename in listify(target['install_filename']):
|
||||||
|
if install_filename.endswith(os.path.basename(filename)):
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
# None of the installed files in the target correspond to the built
|
||||||
|
# filename, so skip
|
||||||
|
return False
|
||||||
|
fpath = PurePath(install_filename)
|
||||||
|
if fpath.parent != bindir:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
def get_wine_subprocess_env(options, env):
|
def get_wine_subprocess_env(options, env):
|
||||||
with open(os.path.join(options.builddir, 'meson-info', 'intro-buildoptions.json')) as f:
|
with open(os.path.join(options.builddir, 'meson-info', 'intro-buildoptions.json')) as f:
|
||||||
|
@ -206,10 +225,14 @@ def get_subprocess_env(options, gst_version):
|
||||||
build_options_s = subprocess.check_output(meson + ['introspect', options.builddir, '--buildoptions'])
|
build_options_s = subprocess.check_output(meson + ['introspect', options.builddir, '--buildoptions'])
|
||||||
build_options = json.loads(build_options_s.decode())
|
build_options = json.loads(build_options_s.decode())
|
||||||
libdir, = [o['value'] for o in build_options if o['name'] == 'libdir']
|
libdir, = [o['value'] for o in build_options if o['name'] == 'libdir']
|
||||||
libdir = libdir.replace('\\', '/')
|
libdir = PurePath(libdir)
|
||||||
|
prefix, = [o['value'] for o in build_options if o['name'] == 'prefix']
|
||||||
|
bindir, = [o['value'] for o in build_options if o['name'] == 'bindir']
|
||||||
|
prefix = PurePath(prefix)
|
||||||
|
bindir = prefix / bindir
|
||||||
|
|
||||||
global GSTPLUGIN_FILEPATH_REG_TEMPLATE
|
global GSTPLUGIN_FILEPATH_REG_TEMPLATE
|
||||||
GSTPLUGIN_FILEPATH_REG_TEMPLATE = GSTPLUGIN_FILEPATH_REG_TEMPLATE.format(libdir=libdir)
|
GSTPLUGIN_FILEPATH_REG_TEMPLATE = GSTPLUGIN_FILEPATH_REG_TEMPLATE.format(libdir=libdir.as_posix())
|
||||||
|
|
||||||
for target in targets:
|
for target in targets:
|
||||||
filenames = listify(target['filename'])
|
filenames = listify(target['filename'])
|
||||||
|
@ -227,7 +250,7 @@ def get_subprocess_env(options, gst_version):
|
||||||
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),
|
||||||
options.sysroot)
|
options.sysroot)
|
||||||
elif target['type'] == 'executable' and target['installed']:
|
elif is_binary_target_and_in_path(target, filename, bindir):
|
||||||
paths.add(os.path.join(options.builddir, root))
|
paths.add(os.path.join(options.builddir, root))
|
||||||
|
|
||||||
with open(os.path.join(options.builddir, 'GstPluginsPath.json')) as f:
|
with open(os.path.join(options.builddir, 'GstPluginsPath.json')) as f:
|
||||||
|
|
Loading…
Reference in a new issue