From: Yeongjin Jeong Date: Mon, 29 Jul 2019 03:22:55 +0000 (+0900) Subject: uninstalled: Ensure bash prompt override even if bash script file does not exist X-Git-Tag: 1.19.3~481^2~197 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8568e471fa5a3c7e874eed66519642cdd97304bd;p=platform%2Fupstream%2Fgstreamer.git 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. --- diff --git a/gst-uninstalled.py b/gst-uninstalled.py index 7db8be6..eb275f3 100755 --- a/gst-uninstalled.py +++ b/gst-uninstalled.py @@ -298,16 +298,16 @@ if __name__ == "__main__": else: 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")): + tmprc = tempfile.NamedTemporaryFile(mode='w') 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"' % gst_version) - tmprc.flush() - # Let the GC remove the tmp file - args.append("--rcfile") - args.append(tmprc.name) + tmprc.write('\nexport PS1="[gst-%s] $PS1"' % gst_version) + tmprc.flush() + # Let the GC remove the tmp file + args.append("--rcfile") + args.append(tmprc.name) try: exit(subprocess.call(args, close_fds=False, env=get_subprocess_env(options, gst_version)))