MCPcopy Create free account
hub / github.com/conda/constructor / prepare

Method prepare

constructor/briefcase.py:420–459  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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'.

Callers 7

createFunction · 0.95
test_prepare_payloadFunction · 0.95
test_payload_layoutFunction · 0.95
test_payload_removeFunction · 0.95
test_payload_conda_exeFunction · 0.95

Calls 8

render_templatesMethod · 0.95
write_pyproject_tomlMethod · 0.95
_stage_distsMethod · 0.95
_stage_user_scriptsMethod · 0.95
_stage_condaMethod · 0.95
make_archiveMethod · 0.95
write_imagesFunction · 0.85
getMethod · 0.80

Tested by 6

test_prepare_payloadFunction · 0.76
test_payload_layoutFunction · 0.76
test_payload_removeFunction · 0.76
test_payload_conda_exeFunction · 0.76