houdini packages: Load enviroments depending on env var

   297   1   0
User Avatar
Member
1 posts
Joined: Sept. 2024
Offline
Hi all. I am tortured by how to do this with houdini's package system.

i have a enviroment variable called "redshift_version". This can either be a version number like:"3.06.4", or an empty string: "".

This is set before houdini is launched. I would like my redshift.json in the packages directory to to load redshift versions depending on the 'redshift_version env var'

This works if the 'redshift_version' is set to a value:
{
"env":[
{"RS_PLUGIN_VERSION" : "${HOUDINI_VERSION}"},
{"REDSHIFT_COREDATAPATH": "R:/RedshiftGlobal/${redshift_version}"},
{"HOUDINI_PATH": "${REDSHIFT_COREDATAPATH}/Plugins/Houdini/${HOUDINI_VERSION}"},
{"PATH": "R:/RedshiftGlobal/${redshift_version}/bin"},
{"PXR_PLUGINPATH_NAME" : "${REDSHIFT_COREDATAPATH}/Plugins/Solaris/${RS_PLUGIN_VERSION}"}
]
}

but ofcourse, if the 'redshift_version' env var is just an empty string, all the '${redshift_version}' variables will be replaced by nothing. Or an empty string that is.

I've tried everything i can think of. I checked to docs, asked chatgtp, experimented on my own, but i cannot for the life of me get this to work. Does anyone have any pointers?
User Avatar
Staff
445 posts
Joined: Feb. 2018
Offline
You could use the package's default var syntax [www.sidefx.com] to access $redshift_version. With this syntax you can provide a default value if an env var does not exist or is empty.

Example: $RSVER is set with ${redshift_version} or "3.06.4" if ${redshift_version} does not exist or is empty.
{"RSVER": ${redshift_version-"3.06.4"},
{"PATH": "R:/RedshiftGlobal/${RSVER}/bin"},
  • Quick Links