I know I can create an env_vars.(bat|sh) inside the activate.d directory in an environment, however I want the variables to be included as part of a package, so if the package is swapped out to a different version, it will change the environment variables.
According to the documentation here: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#saving-environment-variables, I should be able to create an env_vars.(bat|sh) as part of a conda package
This type of script file can be part of a conda package, in which case these environment variables become active when an environment containing that package is activated.
You can name these scripts anything you like. However, multiple packages may create script files, so be sure to use descriptive names that are not used by other packages. One popular option is to give the script a name in the form packagename-scriptname.sh, or on Windows, packagename-scriptname.bat.
I've tried creating both env_vars.bat and packagename-env_vars.bat which then set environment variables as described in the docs, but installing the package and activating the environment does not create the variables. Is there another step I need to do?
My meta.yml:
package:
name: maya
version: 2020
My env_vars.bat:
set MAYA_VERSION=2020
set MAYA_LOCATION="C:\Program Files\Autodesk\Maya%MAYA_VERSION%"