diff --git a/src/rez/rex.py b/src/rez/rex.py index 9eccdfda2..aa25707d6 100644 --- a/src/rez/rex.py +++ b/src/rez/rex.py @@ -277,7 +277,8 @@ def _fn(str_): # in a request string which python on windows will expand # regardless if the user exists or not matches = re.findall(r"[\\/]?", str_) - matches = list(set(matches)).remove("") + matches = list(set(matches)) + matches.remove("") if matches: return os.path.expanduser(str_) else: diff --git a/src/rez/shells.py b/src/rez/shells.py index 4dec45245..2c2fe5955 100644 --- a/src/rez/shells.py +++ b/src/rez/shells.py @@ -139,8 +139,7 @@ def get_syspaths(cls): def __init__(self): self._lines = [] self.settings = config.plugins.shell[self.name()] - self.env_sep_map = self._get_env_sep_map() - self.validate_env_sep_map() + self.env_sep_map = self._shell_env_seps() def _global_env_seps(self): setting = self.env_sep_map_setting @@ -148,18 +147,20 @@ def _global_env_seps(self): return value def _shell_env_seps(self): + self.validate_env_sep_map() shell = self.name() setting = self.shell_env_sep_map_setting values = config.get(setting, {}) value = values.get(shell, {}) return value - def _get_env_sep_map(self): + def validate_env_sep_map(self): """ - Get a dict of environment variable names to path separators. + Validate environment path separator settings. """ - if getattr(self, "env_sep_map", None): - return self.env_sep_map + # Return early if validation is disabled. + if not config.warn("shell_startup"): + return global_env_seps = self._global_env_seps() shell_env_seps = self._shell_env_seps() @@ -180,11 +181,6 @@ def _get_env_sep_map(self): pathsep, ) - return shell_env_seps - - def validate_env_sep_map(self): - pass - def _addline(self, line): self._lines.append(line)