Prepares the payload. Directory structure created during preparation: / (temporary directory, see :attr:`root`) ├── welcome.bmp, header.bmp, icon.ico (branding images for WiX UI, not installed) └── /
(self)
| 418 | pass |
| 419 | |
| 420 | def prepare(self) -> None: |
| 421 | """Prepares the payload. |
| 422 | |
| 423 | Directory structure created during preparation: |
| 424 | |
| 425 | <root>/ (temporary directory, see :attr:`root`) |
| 426 | ├── welcome.bmp, header.bmp, icon.ico (branding images for WiX UI, not installed) |
| 427 | └── <EXTERNAL_PACKAGE_PATH>/ (external_dir: contains the payload archive and conda exe) |
| 428 | └── base/ (base_dir: represents the base conda environment) |
| 429 | └── pkgs/ (pkgs_dir: staging area for conda package distributions) |
| 430 | |
| 431 | Note: base_dir and pkgs_dir are removed after archiving. |
| 432 | """ |
| 433 | external_dir = self.root / EXTERNAL_PACKAGE_PATH |
| 434 | external_dir.mkdir(parents=True, exist_ok=True) |
| 435 | |
| 436 | write_images(self.info, self.root, installer_type="msi") |
| 437 | |
| 438 | # Note that the directory name "base" is also explicitly defined in `run_installation.bat` |
| 439 | base_dir = external_dir / "base" |
| 440 | base_dir.mkdir() |
| 441 | |
| 442 | pkgs_dir = base_dir / "pkgs" |
| 443 | pkgs_dir.mkdir() |
| 444 | |
| 445 | self.render_templates() |
| 446 | self.write_pyproject_toml(self.root, external_dir) |
| 447 | |
| 448 | preconda.write_files(self.info, base_dir) |
| 449 | preconda.copy_extra_files(self.info.get("extra_files", []), base_dir) |
| 450 | # Copy license file to PREFIX, matching behavior of other installer types |
| 451 | if license_file := self.info.get("license_file"): |
| 452 | preconda.copy_extra_files([license_file], base_dir) |
| 453 | self._stage_dists(pkgs_dir) |
| 454 | self._stage_user_scripts(pkgs_dir) |
| 455 | self._stage_conda(external_dir) |
| 456 | |
| 457 | archive_path = self.make_archive(base_dir, external_dir) |
| 458 | if not archive_path.exists(): |
| 459 | raise RuntimeError(f"Unexpected error, failed to create archive: {archive_path}") |
| 460 | |
| 461 | def make_archive(self, src: Path, dst: Path) -> Path: |
| 462 | """Create an archive of the directory 'src'. |