cashapp/hermit

Feature Request: Support zipapp applications

damienrj opened this issue ยท 1 comments

Now that we have python working via hermit, it should be easy to support zipapp stand alone applications. (Reference). This just requires needing python available on the system.

I think something like this should work.

description = "Pre-commit is a multi-language package manager for pre-commit hooks."
binaries = ["pre-commit"]
test = "pre-commit --version"
source = "https://github.com/pre-commit/pre-commit/releases/download/v${version}/pre-commit-${version}.pyz"
strip = 1
runtime-dependencies = ["python3@3.9"]
provides=["pre-commit"]

on unpack {
  rename { from = "${root}/pre-commit-${version}.pyz" to = "${root}/pre-commit" }
  chmod { file = "${root}/pre-commit" mode = 0700 }
}

version "2.17.0" {
  auto-version {
    github-release = "pre-commit/pre-commit"
  }
}

However currently hermit wants to unpack the file, but this isn't needed and throws an error.

fatal:hermit: don't know how to extract archive....

I just tried this manifest with dont-unpack = true and it works!

๐Ÿš ~/Projects/hermit-packages $ hermit install pre-commit                                                                                                master
info:pre-commit-2.17.0:install: Installing pre-commit-2.17.0
๐Ÿš ~/Projects/hermit-packages $ pre-commit --help                                                                                                        master
usage: pre-commit [-h] [-V]
                  {autoupdate,clean,hook-impl,gc,init-templatedir,install,install-hooks,migrate-config,run,sample-config,try-repo,uninstall,help} ...

positional arguments:
  {autoupdate,clean,hook-impl,gc,init-templatedir,install,install-hooks,migrate-config,run,sample-config,try-repo,uninstall,help}
    autoupdate          Auto-update pre-commit config to the latest repos' versions.
    clean               Clean out pre-commit files.
    gc                  Clean unused cached repos.
    init-templatedir    Install hook script in a directory intended for use with `git config init.templateDir`.
    install             Install the pre-commit script.
    install-hooks       Install hook environments for all environments in the config file. You may find `pre-commit install --install-hooks` more useful.
    migrate-config      Migrate list configuration to new map configuration.
    run                 Run hooks.
    sample-config       Produce a sample .pre-commit-config.yaml file
    try-repo            Try the hooks in a repository, useful for developing new hooks.
    uninstall           Uninstall the pre-commit script.
    help                Show help for a specific command.

optional arguments:
  -h, --help            show this help message and exit
  -V, --version         show program's version number and exit