Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend set_environment #170

Merged
merged 1 commit into from
Feb 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions protonfixes/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,13 +388,21 @@ def append_argument(argument):
sys.argv.append(argument)
log.debug('New commandline: ' + str(sys.argv))

def set_environment(envvar, value):
""" Add or override an environment value
def set_environment(envvar, value, separator=None):
""" Add, extend or override an environment value
"""
os_env = value
pm_env = value

log.info('Adding env: ' + envvar + '=' + value)
os.environ[envvar] = value
protonmain.g_session.env[envvar] = value
if separator is not None:
if envvar in os.environ:
os_env = os.environ[envvar] + separator + value
if envvar in protonmain.g_session.env:
pm_env = protonmain.g_session.env[envvar] + separator + value

log.info('Adding env: ' + envvar + '=' + pm_env)
os.environ[envvar] = os_env
protonmain.g_session.env[envvar] = pm_env

def del_environment(envvar):
""" Remove an environment variable
Expand Down