import sys
from pathlib import Path


def package_build(
    development: bool, frozen_dir: Path, frozen_version: str, prefer_archive: bool = False, skip_signing: bool = False
):
    if sys.platform.startswith("win"):
        from dev_tools.build.package.win import build_archive, build_installer

        if development or prefer_archive:
            build_archive(development, frozen_dir, frozen_version)
        else:
            build_installer(development, frozen_dir, frozen_version, skip_signing)
    elif sys.platform.startswith("linux"):
        from dev_tools.build.package.posix import build_archive, build_appimage

        if prefer_archive:
            build_archive(development, frozen_dir, frozen_version)
        else:
            build_appimage(development, frozen_dir, frozen_version)
    elif sys.platform.startswith("darwin"):
        pass  # packaging is done with cx-Freeze right after build
    else:
        raise NotImplementedError()
