-
Notifications
You must be signed in to change notification settings - Fork 356
Description
Currently, rez has two ways to consider env variables: path or not paths.
When an env variable is a path, it will handle slashes and separators a specific way based on the shell used:
https://rez.readthedocs.io/en/stable/package_commands.html#filepaths
https://rez.readthedocs.io/en/stable/configuring_rez.html#pathed_env_vars
Line 560 in 2933636
| def _is_pathed_key(cls, key): |
rez/src/rezplugins/shell/cmd.py
Line 253 in 2933636
| value = self.escape_string(value, is_path=self._is_pathed_key(key)) |
The current way to configure this is a bit limited, there is no way to exclude any pattern from the global config, nor is there a way to configure a specific pathsep or slash direction for a specific env variable.
Motivation
Some DCCs/apps expect certain conventions that do not always match the OS or the shell's defaults, and being able to configure those would be helpful.
We currently sometimes have to go around rez to make sure some environment variables are set the right way.
Possible implementations
I didn't fully think this through but have 2 examples:
This could be implemented at a global config level, with a mapping of certain env vars and the settings they should use, for example:
env_vars_settings = {
'HOUDINI_PACKAGE_DIR' : {
'is_path' = True,
'list_sparator': ';',
'path_separator': 'default'
}
}Cons: Possibly a lot to configure, possible ambiguity between config and shell plugins.
Another way could be to allow setting it in the packages directly:
env.HOUDINI_PACKAGE_DIR.set_path_separator('/')
env.MYENVPATH.set_is_path(False)Pros: Pretty granular, less package-specific definitions at the global level
Cons: Can get pretty verbose, what should happen is multiple packages try to configure the same env variable differently?
Related Issues/PRs