Build environment setup data for base and extra_envs. Returns a list of dicts, each containing the data needed to install one environment. Used by the run_installation.bat template.
(info: dict)
| 201 | |
| 202 | |
| 203 | def _setup_envs_commands(info: dict) -> list[dict]: |
| 204 | """Build environment setup data for base and extra_envs. |
| 205 | |
| 206 | Returns a list of dicts, each containing the data needed to install |
| 207 | one environment. Used by the run_installation.bat template. |
| 208 | """ |
| 209 | environments = [] |
| 210 | |
| 211 | # Base environment |
| 212 | environments.append( |
| 213 | { |
| 214 | "name": "base", |
| 215 | "prefix": "%BASE_PATH%", |
| 216 | "lockfile": r"%BASE_PATH%\conda-meta\initial-state.explicit.txt", |
| 217 | "channels": ",".join(get_final_channels(info)), |
| 218 | "shortcuts": shortcuts_flags(info), |
| 219 | } |
| 220 | ) |
| 221 | |
| 222 | # Extra environments |
| 223 | for env_name in info.get("_extra_envs_info", {}): |
| 224 | env_config = info["extra_envs"][env_name] |
| 225 | # Needed for shortcuts_flags function |
| 226 | if "_conda_exe_type" not in env_config: |
| 227 | env_config["_conda_exe_type"] = info.get("_conda_exe_type") |
| 228 | channel_info = { |
| 229 | "channels": env_config.get("channels", info.get("channels", ())), |
| 230 | "channels_remap": env_config.get("channels_remap", info.get("channels_remap", ())), |
| 231 | } |
| 232 | environments.append( |
| 233 | { |
| 234 | "name": env_name, |
| 235 | "prefix": rf"%BASE_PATH%\envs\{env_name}", |
| 236 | "lockfile": rf"%BASE_PATH%\envs\{env_name}\conda-meta\initial-state.explicit.txt", |
| 237 | "channels": ",".join(get_final_channels(channel_info)), |
| 238 | "shortcuts": shortcuts_flags(env_config), |
| 239 | } |
| 240 | ) |
| 241 | |
| 242 | return environments |
| 243 | |
| 244 | |
| 245 | def create_uninstall_options_list(info: dict) -> list[dict]: |