From a92bdc6946aebf685104660d4edf8370632ce940 Mon Sep 17 00:00:00 2001 From: amorphousWaste <20346603+amorphousWaste@users.noreply.github.com> Date: Tue, 25 Oct 2022 12:45:45 -0700 Subject: [PATCH] Add special logic for implicit keys and values Signed-off-by: amorphousWaste <20346603+amorphousWaste@users.noreply.github.com> --- src/rezplugins/shell/sh.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/rezplugins/shell/sh.py b/src/rezplugins/shell/sh.py index d353c3c78..6372b6dc8 100644 --- a/src/rezplugins/shell/sh.py +++ b/src/rezplugins/shell/sh.py @@ -104,10 +104,13 @@ def _bind_interactive_rez(self): self._addline(cmd % r"\[\e[1m\]$REZ_ENV_PROMPT\[\e[0m\]") def setenv(self, key, value): + is_implicit = key == 'REZ_USED_IMPLICIT_PACKAGES' + value = self.escape_string( value, is_path=self._is_pathed_key(key), is_shell_path=self._is_shell_pathed_key(key), + is_implicit=is_implicit, ) self._addline('export %s=%s' % (key, value)) @@ -124,9 +127,13 @@ def source(self, value): value = self.escape_string(value) self._addline('. %s' % value) - def escape_string(self, value, is_path=False, is_shell_path=False): + def escape_string( + self, value, is_path=False, is_shell_path=False, is_implicit=False + ): value = EscapedString.promote(value) - value = value.expanduser() + if not is_implicit: + value = value.expanduser() + result = '' for is_literal, txt in value.strings: