Allow executing one process inside the uninstalled environment

This commit is contained in:
Thibault Saunier 2016-09-06 00:00:17 -03:00
parent 7e7caeec93
commit 80e467ede8

View file

@ -7,7 +7,7 @@ import site
import subprocess import subprocess
SCRIPTDIR = os.path.dirname(__file__) SCRIPTDIR = os.path.abspath(os.path.dirname(__file__))
def prepend_env_var(env, var, value): def prepend_env_var(env, var, value):
@ -114,18 +114,19 @@ if __name__ == "__main__":
help="The meson build directory") help="The meson build directory")
parser.add_argument("--gst-version", default="master", parser.add_argument("--gst-version", default="master",
help="The meson build directory") help="The meson build directory")
options = parser.parse_args() options, args = parser.parse_known_args()
if not os.path.exists(options.builddir): if not os.path.exists(options.builddir):
print("GStreamer not built in %s\n\nBuild it and try again" % print("GStreamer not built in %s\n\nBuild it and try again" %
options.builddir) options.builddir)
exit(1) exit(1)
shell_args = [os.environ.get("SHELL", os.path.realpath("/bin/sh"))] if not args:
if shell_args[0] == "/bin/bash": args = [os.environ.get("SHELL", os.path.realpath("/bin/sh"))]
shell_args.append("--noprofile") if args[0] == "/bin/bash":
args.append("--noprofile")
try: try:
exit(subprocess.run(shell_args, env=get_subprocess_env(options)).returncode) exit(subprocess.run(args, env=get_subprocess_env(options)).returncode)
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
exit(e.returncode) exit(e.returncode)