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

Method write_pyproject_toml

constructor/briefcase.py:555–598  ·  view source on GitHub ↗
(self, root: Path, external: Path)

Source from the content-addressed store, hash-verified

553 return list(templates.values())
554
555 def write_pyproject_toml(self, root: Path, external: Path) -> None:
556 name, version = get_name_version(self.info)
557 bundle, app_name = get_bundle_app_name(self.info, name)
558
559 config = {
560 "project_name": name,
561 "bundle": bundle,
562 "version": version,
563 "license": get_license(self.info, root),
564 "app": {
565 app_name: {
566 "formal_name": f"{self.info['name']} {self.info['version']}",
567 "description": "", # Required, but not used in the installer.
568 "external_package_path": str(external),
569 "use_full_install_path": False,
570 "install_launcher": False,
571 "install_option": create_install_options_list(self.info),
572 "uninstall_option": create_uninstall_options_list(self.info),
573 "post_install_script": str(root / "run_installation.bat"),
574 "pre_uninstall_script": str(root / "pre_uninstall.bat"),
575 }
576 },
577 }
578
579 # Add optional branding images (only if user provided them in construct.yaml)
580 # Images are stored at root level, not in external_dir, to avoid bundling them in the payload
581 icon_ico = root / "icon.ico"
582 if icon_ico.exists():
583 # Briefcase expects icon path WITHOUT extension - it appends .ico
584 config["app"][app_name]["icon"] = str(root / "icon")
585 welcome_bmp = root / "welcome.bmp"
586 if welcome_bmp.exists():
587 config["app"][app_name]["installer_background"] = str(welcome_bmp)
588 header_bmp = root / "header.bmp"
589 if header_bmp.exists():
590 config["app"][app_name]["installer_banner"] = str(header_bmp)
591
592 # Add optional content
593 if "company" in self.info:
594 config["author"] = self.info["company"]
595
596 # Finalize
597 (root / "pyproject.toml").write_text(tomli_w.dumps({"tool": {"briefcase": config}}))
598 logger.debug(f"Created TOML file at: {root}")
599
600 def _stage_dists(self, pkgs_dir: Path) -> None:
601 download_dir = Path(self.info["_download_dir"])

Callers 1

prepareMethod · 0.95

Calls 5

get_name_versionFunction · 0.85
get_bundle_app_nameFunction · 0.85
get_licenseFunction · 0.85

Tested by

no test coverage detected