mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-29 05:01:23 +00:00
gst-uninstalled: make the bash prompt override optional
When using a custom prompt the automatic override may not look good, so provide a mechanism to disable it. Document that the user will have to use GST_ENV manually when setting the prompt to have a visual indicator of the gst-uninstalled environment.
This commit is contained in:
parent
887da9a04b
commit
8af2376bc0
2 changed files with 15 additions and 2 deletions
14
README.md
14
README.md
|
@ -136,7 +136,19 @@ built in a `build` directory you can simply run:
|
||||||
|
|
||||||
### Bash prompt
|
### Bash prompt
|
||||||
|
|
||||||
We automatically handle `bash` and set `$PS1` accordingly
|
We automatically handle `bash` and set `$PS1` accordingly.
|
||||||
|
|
||||||
|
If the automatic `$PS1` override is not desired (maybe you have a fancy custom prompt), set the `$GST_BUILD_DISABLE_PS1_OVERRIDE` environment variable to `TRUE` and use `$GST_ENV` when setting the custom prompt, for example with a snippet like the following:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
...
|
||||||
|
if [[ -n "${GST_ENV-}" ]];
|
||||||
|
then
|
||||||
|
PS1+="[ ${GST_ENV} ]"
|
||||||
|
fi
|
||||||
|
...
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
### Zsh prompt
|
### Zsh prompt
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ import tempfile
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
from distutils.sysconfig import get_python_lib
|
from distutils.sysconfig import get_python_lib
|
||||||
|
from distutils.util import strtobool
|
||||||
|
|
||||||
from common import get_meson
|
from common import get_meson
|
||||||
from common import git
|
from common import git
|
||||||
|
@ -229,7 +230,7 @@ if __name__ == "__main__":
|
||||||
args += ['/k', 'prompt [gst-{}] $P$G'.format(gst_version)]
|
args += ['/k', 'prompt [gst-{}] $P$G'.format(gst_version)]
|
||||||
else:
|
else:
|
||||||
args = [os.environ.get("SHELL", os.path.realpath("/bin/sh"))]
|
args = [os.environ.get("SHELL", os.path.realpath("/bin/sh"))]
|
||||||
if "bash" in args[0]:
|
if "bash" in args[0] and not strtobool(os.environ.get("GST_BUILD_DISABLE_PS1_OVERRIDE", r"FALSE")):
|
||||||
bashrc = os.path.expanduser('~/.bashrc')
|
bashrc = os.path.expanduser('~/.bashrc')
|
||||||
if os.path.exists(bashrc):
|
if os.path.exists(bashrc):
|
||||||
tmprc = tempfile.NamedTemporaryFile(mode='w')
|
tmprc = tempfile.NamedTemporaryFile(mode='w')
|
||||||
|
|
Loading…
Reference in a new issue