diff options
author | Charlie Turner <mail@charles.plus> | 2020-01-06 13:22:54 +0000 |
---|---|---|
committer | Charlie Turner <mail@charles.plus> | 2020-01-06 21:06:42 +0000 |
commit | c57dca5220a2f121331d46691aadb8e7f3168f75 (patch) | |
tree | a82b472ddf2b5cf4c59f0a08fd3b820497fd66fc /gst-env.py | |
parent | 7aaa11aa772053eb82617eb92b5f4ff7424ec3d1 (diff) | |
download | gstreamer-c57dca5220a2f121331d46691aadb8e7f3168f75.tar.gz |
dev environment: allow printing only env without starting a shell
allow for workflows that don't want the gst scripts to start shells,
this can be awkward for higher-level scripts setting up shells
themselves.
this is especially useful in combination with eval, and mimics the sort
of thing you can do with ssh-agent -s.
Diffstat (limited to 'gst-env.py')
-rwxr-xr-x | gst-env.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/gst-env.py b/gst-env.py index 2f83fc1b82..86bb32bea0 100755 --- a/gst-env.py +++ b/gst-env.py @@ -7,6 +7,7 @@ import os import platform import re import site +import shlex import shutil import subprocess import sys @@ -371,6 +372,10 @@ if __name__ == "__main__": parser.add_argument("--winepath", default='', help="Exra path to set to WINEPATH.") + parser.add_argument("--only-environment", + action='store_true', + default=False, + help="Do not start a shell, only print required environment.") options, args = parser.parse_known_args() if not os.path.exists(options.builddir): @@ -440,6 +445,12 @@ if __name__ == "__main__": tmprc.flush() env['ZDOTDIR'] = tmpdir.name try: - exit(subprocess.call(args, close_fds=False, env=env)) + if options.only_environment: + for name, value in env.items(): + print('{}={}'.format(name, shlex.quote(value))) + print('export {}'.format(name)) + else: + exit(subprocess.call(args, close_fds=False, env=env)) + except subprocess.CalledProcessError as e: exit(e.returncode) |