Skip to content

Commit

Permalink
Update implicit package value expansion
Browse files Browse the repository at this point in the history
Signed-off-by: amorphousWaste <20346603+amorphousWaste@users.noreply.github.com>
  • Loading branch information
amorphousWaste authored and Jawabiscuit committed Sep 15, 2023
1 parent 42e37f9 commit 267c3e3
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/rez/rex.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,16 @@ def _value(self, value):
expanded_value = self._expand(unexpanded_value)
return unexpanded_value, expanded_value

def _implicit_value(self, value):
def _fn(str_):
str_ = expandvars(str_, self.environ)
str_ = expandvars(str_, self.parent_environ)
return str_

unexpanded_value = self._format(value)
expanded_value = EscapedString.promote(value).formatted(_fn)
return unexpanded_value, expanded_value

def get_output(self, style=OutputStyle.file):
return self.interpreter.get_output(style=style)

Expand Down Expand Up @@ -307,7 +317,10 @@ def getenv(self, key):

def setenv(self, key, value):
unexpanded_key, expanded_key = self._key(key)
unexpanded_value, expanded_value = self._value(value)
if key == "REZ_USED_IMPLICIT_PACKAGES":
unexpanded_value, expanded_value = self._implicit_value(value)
else:
unexpanded_value, expanded_value = self._value(value)

# TODO: check if value has already been set by another package
self.actions.append(Setenv(unexpanded_key, unexpanded_value))
Expand Down

0 comments on commit 267c3e3

Please sign in to comment.