from functools import lru_cache
from pathlib import PurePath, Path
-from distutils.sysconfig import get_python_lib
-from distutils.util import strtobool
+from typing import Any
from scripts.common import get_meson
from scripts.common import git
BASH_COMPLETION_PATHS = [SCRIPTDIR + '/subprojects/gstreamer/data/bash-completion/completions']
BASH_COMPLETION_PATHS += [SCRIPTDIR + '/subprojects/gst-devtools/validate/data/bash-completion/completions']
+
+def str_to_bool(value: Any) -> bool:
+ """Return whether the provided string (or any value really) represents true. Otherwise false.
+ Just like plugin server stringToBoolean.
+ """
+ if not value:
+ return False
+ return str(value).lower() in ("y", "yes", "t", "true", "on", "1")
+
+
def listify(o):
if isinstance(o, str):
return [o]
options.sysroot)
# gst-indent
- prepend_env_var(env, "PATH", os.path.join(SCRIPTDIR, 'gstreamer', 'tools'),
+ prepend_env_var(env, "PATH", os.path.join(SCRIPTDIR, 'scripts'),
options.sysroot)
# tools: gst-launch-1.0, gst-inspect-1.0
presets = set()
encoding_targets = set()
python_dirs = setup_gdb(options)
+ overrides_dirs = set()
if '--installed' in subprocess.check_output(meson + ['introspect', '-h']).decode():
installed_s = subprocess.check_output(meson + ['introspect', options.builddir, '--installed'])
for path, installpath in json.loads(installed_s.decode()).items():
if 'site-packages' in installpath_parts:
install_subpath = os.path.join(*installpath_parts[installpath_parts.index('site-packages') + 1:])
if path.endswith(install_subpath):
- python_dirs.add(path[:len (install_subpath) * -1])
+ if os.path.commonprefix(["gi/overrides", install_subpath]):
+ overrides_dirs.add(os.path.dirname(path))
+ else:
+ python_dirs.add(path[:len (install_subpath) * -1])
if path.endswith('.prs'):
presets.add(os.path.dirname(path))
for python_dir in sorted(python_dirs):
prepend_env_var(env, 'PYTHONPATH', python_dir, options.sysroot)
+ for python_dir in sorted(overrides_dirs):
+ prepend_env_var(env, '_GI_OVERRIDES_PATH', python_dir, options.sysroot)
+
mesonpath = os.path.join(SCRIPTDIR, "meson")
if os.path.join(mesonpath):
# Add meson/ into PYTHONPATH if we are using a local meson
prepend_env_var(env, 'PYTHONPATH', mesonpath, options.sysroot)
+ # Ensure that gst-python/gi is used first
+ prepend_env_var(env, "PYTHONPATH", os.path.join(SCRIPTDIR, 'subprojects', 'gst-python'),
+ options.sysroot)
+
# For devhelp books
if 'XDG_DATA_DIRS' not in env or not env['XDG_DATA_DIRS']:
# Preserve default paths when empty
args += ['/k', 'prompt [gst-{}] $P$G'.format(gst_version)]
else:
args = [os.environ.get("SHELL", os.path.realpath("/bin/sh"))]
- if args[0].endswith('bash') and not strtobool(os.environ.get("GST_BUILD_DISABLE_PS1_OVERRIDE", r"FALSE")):
+ if args[0].endswith('bash') and not str_to_bool(os.environ.get("GST_BUILD_DISABLE_PS1_OVERRIDE", r"FALSE")):
# Let the GC remove the tmp file
tmprc = tempfile.NamedTemporaryFile(mode='w')
bashrc = os.path.expanduser('~/.bashrc')
print('{}={}'.format(name, shlex.quote(value)))
print('export {}'.format(name))
else:
+ if os.environ.get("CI_PROJECT_NAME"):
+ print("Ignoring SIGINT when running on the CI,"
+ " as we get spurious sigint in there for some reason.")
+ signal.signal(signal.SIGINT, signal.SIG_IGN)
exit(subprocess.call(args, close_fds=False, env=env))
except subprocess.CalledProcessError as e: