Launch applications with environment variables from multiple config files.
python dwenv/launcher.py --config maya_np.env --executable maya
-
maya_np.envcontent:np_configs_dir/prod.envc np_configs_dir/maya.envc np_configs_dir/animschoolpicker.envc ... -
prod.envccontent:PROD_NAME = Neti Pikola PROD_CODE = NP FRAMERATE = 25 PROD_ROOT = /path/to/prod_root SOFTWARE_ROOT = ${PROD_ROOT}/software PYTHONPATH > ${SOFTWARE_ROOT}/prodlib ... -
maya.envccontent:PATH > ${MAYA_LOCATION}/bin MAYA_VP2_DEVICE_OVERRIDE = VirtualDeviceGL ... -
animschoolpicker.envccontent:MAYA_PLUG_IN_PATH.windows > ${SOFTWARE_ROOT}/animschoolpicker/windows/2018 MAYA_PLUG_IN_PATH.linux > ${SOFTWARE_ROOT}/animschoolpicker/linux/2018 ...
--config (-c) Environment config path
--executable (-x) Executable path
--arguments (-a) Executable arguments. Use quotes: -a="..."
--dry-run (-d) Prints resulting environment without running anything
Each .envc line look like this:
ENV_NAME(.platform) [operator] value
-
There is three operators for .envc files. Spaces around them are mandatory:
- "
=" will set or replace a variable. Replacing an existing variable will print a warning. - "
>" appends string/path to existing variable with os path separator (:/;) - "
<" prepends ...
- "
-
If a variable must be set for a specific operating system, add
[.platform]to variable name:- "
VAR.windows = x" - "
VAR.linux = y" - "
VAR.darwin = z" - ...
- "
-
All environment expressions will be expanded if they exists. Thus, the order of the environment configs matter.
There is no other dependency trickery. Just list what you need. -
You can comment a line with "
#".
import dwenv.env
env = dwenv.env.build_env(
configs_paths=None,
start_env='current',
vars_to_remove=None,
initial_vars=None,
target_platform=None,
start_env_backup_path=None,
set_current_env=False,
verbose=False)Using launcher.py or build_env function will also set DWENV_CONFIG var to know which config was used to generate the environment. You can then later re-use this path together with the target_platform argument if you need to send a job on another platform.
