at the root of `gst-build/` for example GStreamer core will be in `gstreamer/`. Otherwise
they will be present in `subprojects/`. You can simply hack in there and to rebuild you
just need to rerun `ninja -C build/`.
+
+
+## Add information about GStreamer development environment in your prompt line
+
+### Bash prompt
+
+We automatically handle `bash` and set `$PS1` accordingly
+
+### Zsh prompt
+
+In your `.zshrc`, you should add something like:
+
+```
+export PROMPT="$GST_ENV-$PROMPT"
+```
+
+### Using powerline
+
+In your powerline theme configuration file (by default in
+`{POWERLINE INSTALLATION DIR}/config_files/themes/shell/default.json`)
+you should add a new environment segment as follow:
+
+```
+{
+ "function": "powerline.segments.common.env.environment",
+ "args": { "variable": "GST_ENV" },
+ "priority": 50
+},
+```
import os
import re
import site
+import shutil
import subprocess
+import tempfile
SCRIPTDIR = os.path.abspath(os.path.dirname(__file__))
env[var] = env[var].replace(os.pathsep + os.pathsep, os.pathsep).strip(os.pathsep)
-def set_prompt_var(options, env):
- ps1 = env.get("PS1")
- if ps1:
- env["PS1"] = "[gst-%s] %s" % (options.gst_version, ps1)
-
- prompt = env.get("PROMPT")
- if prompt:
- env["PROMPT"] = "[gst-%s] %s" % (options.gst_version, prompt)
-
-
def get_subprocess_env(options):
env = os.environ.copy()
prepend_env_var(env, "PATH", os.path.join(SCRIPTDIR, 'meson'))
env["PATH"] += os.pathsep + PATH
env["GST_VERSION"] = options.gst_version
+ env["GST_ENV"] = 'gst-' + options.gst_version
env["GST_PLUGIN_SYSTEM_PATH"] = ""
env["GST_PLUGIN_SCANNER"] = os.path.normpath(
"%s/subprojects/gstreamer/libs/gst/helpers/gst-plugin-scanner" % options.builddir)
if has_typelib:
break
-
- set_prompt_var(options, env)
-
return env
args = [os.environ.get("COMSPEC", r"C:\WINDOWS\system32\cmd.exe")]
else:
args = [os.environ.get("SHELL", os.path.realpath("/bin/sh"))]
- if args[0] == "/bin/bash":
- args.append("--noprofile")
+ if "bash" in args[0]:
+ bashrc = os.path.expanduser('~/.bashrc')
+ if os.path.exists(bashrc):
+ tmprc = tempfile.NamedTemporaryFile(mode='w')
+ with open(bashrc, 'r') as src:
+ shutil.copyfileobj(src, tmprc)
+ tmprc.write('\nexport PS1="[gst-%s] $PS1"' % options.gst_version)
+ tmprc.flush()
+ # Let the GC remove the tmp file
+ args.append("--rcfile")
+ args.append(tmprc.name)
try:
exit(subprocess.call(args, env=get_subprocess_env(options)))