mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 03:31:05 +00:00
uninstalled: Ensure bash prompt override even if bash script file does not exist
If automatic bash prompt override is enabled via the 'GST_BUILD_DISABLE_PS1_OVERRIDE', We should set the bash prompt to have a visual indicator of the "gst-uninstalled" environment even if bash script file does not exist.
This commit is contained in:
parent
d0acfc2bf7
commit
8568e471fa
1 changed files with 6 additions and 6 deletions
|
@ -298,16 +298,16 @@ if __name__ == "__main__":
|
||||||
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] and not strtobool(os.environ.get("GST_BUILD_DISABLE_PS1_OVERRIDE", r"FALSE")):
|
if "bash" in args[0] and not strtobool(os.environ.get("GST_BUILD_DISABLE_PS1_OVERRIDE", r"FALSE")):
|
||||||
|
tmprc = tempfile.NamedTemporaryFile(mode='w')
|
||||||
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')
|
|
||||||
with open(bashrc, 'r') as src:
|
with open(bashrc, 'r') as src:
|
||||||
shutil.copyfileobj(src, tmprc)
|
shutil.copyfileobj(src, tmprc)
|
||||||
tmprc.write('\nexport PS1="[gst-%s] $PS1"' % gst_version)
|
tmprc.write('\nexport PS1="[gst-%s] $PS1"' % gst_version)
|
||||||
tmprc.flush()
|
tmprc.flush()
|
||||||
# Let the GC remove the tmp file
|
# Let the GC remove the tmp file
|
||||||
args.append("--rcfile")
|
args.append("--rcfile")
|
||||||
args.append(tmprc.name)
|
args.append(tmprc.name)
|
||||||
try:
|
try:
|
||||||
exit(subprocess.call(args, close_fds=False,
|
exit(subprocess.call(args, close_fds=False,
|
||||||
env=get_subprocess_env(options, gst_version)))
|
env=get_subprocess_env(options, gst_version)))
|
||||||
|
|
Loading…
Reference in a new issue