From c1708295cbf8fb34df0460518f76a5b3346e3f90 Mon Sep 17 00:00:00 2001 From: Moe Jangda Date: Fri, 25 Oct 2024 22:07:24 +1100 Subject: [PATCH] hermitize --- bin/.python3-3.12.3.pkg | 1 + bin/.uv-0.4.26.pkg | 1 + bin/README.hermit.md | 7 +++++++ bin/activate-hermit | 21 ++++++++++++++++++++ bin/hermit | 43 +++++++++++++++++++++++++++++++++++++++++ bin/hermit.hcl | 2 ++ bin/pip | 1 + bin/pip3 | 1 + bin/pip3.12 | 1 + bin/pydoc3 | 1 + bin/pydoc3.12 | 1 + bin/python | 1 + bin/python3 | 1 + bin/python3-config | 1 + bin/python3.12 | 1 + bin/python3.12-config | 1 + bin/uv | 1 + bin/uvx | 1 + 18 files changed, 87 insertions(+) create mode 120000 bin/.python3-3.12.3.pkg create mode 120000 bin/.uv-0.4.26.pkg create mode 100644 bin/README.hermit.md create mode 100755 bin/activate-hermit create mode 100755 bin/hermit create mode 100644 bin/hermit.hcl create mode 120000 bin/pip create mode 120000 bin/pip3 create mode 120000 bin/pip3.12 create mode 120000 bin/pydoc3 create mode 120000 bin/pydoc3.12 create mode 120000 bin/python create mode 120000 bin/python3 create mode 120000 bin/python3-config create mode 120000 bin/python3.12 create mode 120000 bin/python3.12-config create mode 120000 bin/uv create mode 120000 bin/uvx diff --git a/bin/.python3-3.12.3.pkg b/bin/.python3-3.12.3.pkg new file mode 120000 index 00000000..383f4511 --- /dev/null +++ b/bin/.python3-3.12.3.pkg @@ -0,0 +1 @@ +hermit \ No newline at end of file diff --git a/bin/.uv-0.4.26.pkg b/bin/.uv-0.4.26.pkg new file mode 120000 index 00000000..383f4511 --- /dev/null +++ b/bin/.uv-0.4.26.pkg @@ -0,0 +1 @@ +hermit \ No newline at end of file diff --git a/bin/README.hermit.md b/bin/README.hermit.md new file mode 100644 index 00000000..e889550b --- /dev/null +++ b/bin/README.hermit.md @@ -0,0 +1,7 @@ +# Hermit environment + +This is a [Hermit](https://github.com/cashapp/hermit) bin directory. + +The symlinks in this directory are managed by Hermit and will automatically +download and install Hermit itself as well as packages. These packages are +local to this environment. diff --git a/bin/activate-hermit b/bin/activate-hermit new file mode 100755 index 00000000..fe28214d --- /dev/null +++ b/bin/activate-hermit @@ -0,0 +1,21 @@ +#!/bin/bash +# This file must be used with "source bin/activate-hermit" from bash or zsh. +# You cannot run it directly +# +# THIS FILE IS GENERATED; DO NOT MODIFY + +if [ "${BASH_SOURCE-}" = "$0" ]; then + echo "You must source this script: \$ source $0" >&2 + exit 33 +fi + +BIN_DIR="$(dirname "${BASH_SOURCE[0]:-${(%):-%x}}")" +if "${BIN_DIR}/hermit" noop > /dev/null; then + eval "$("${BIN_DIR}/hermit" activate "${BIN_DIR}/..")" + + if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ]; then + hash -r 2>/dev/null + fi + + echo "Hermit environment $("${HERMIT_ENV}"/bin/hermit env HERMIT_ENV) activated" +fi diff --git a/bin/hermit b/bin/hermit new file mode 100755 index 00000000..7fef7692 --- /dev/null +++ b/bin/hermit @@ -0,0 +1,43 @@ +#!/bin/bash +# +# THIS FILE IS GENERATED; DO NOT MODIFY + +set -eo pipefail + +export HERMIT_USER_HOME=~ + +if [ -z "${HERMIT_STATE_DIR}" ]; then + case "$(uname -s)" in + Darwin) + export HERMIT_STATE_DIR="${HERMIT_USER_HOME}/Library/Caches/hermit" + ;; + Linux) + export HERMIT_STATE_DIR="${XDG_CACHE_HOME:-${HERMIT_USER_HOME}/.cache}/hermit" + ;; + esac +fi + +export HERMIT_DIST_URL="${HERMIT_DIST_URL:-https://github.com/cashapp/hermit/releases/download/stable}" +HERMIT_CHANNEL="$(basename "${HERMIT_DIST_URL}")" +export HERMIT_CHANNEL +export HERMIT_EXE=${HERMIT_EXE:-${HERMIT_STATE_DIR}/pkg/hermit@${HERMIT_CHANNEL}/hermit} + +if [ ! -x "${HERMIT_EXE}" ]; then + echo "Bootstrapping ${HERMIT_EXE} from ${HERMIT_DIST_URL}" 1>&2 + INSTALL_SCRIPT="$(mktemp)" + # This value must match that of the install script + INSTALL_SCRIPT_SHA256="180e997dd837f839a3072a5e2f558619b6d12555cd5452d3ab19d87720704e38" + if [ "${INSTALL_SCRIPT_SHA256}" = "BYPASS" ]; then + curl -fsSL "${HERMIT_DIST_URL}/install.sh" -o "${INSTALL_SCRIPT}" + else + # Install script is versioned by its sha256sum value + curl -fsSL "${HERMIT_DIST_URL}/install-${INSTALL_SCRIPT_SHA256}.sh" -o "${INSTALL_SCRIPT}" + # Verify install script's sha256sum + openssl dgst -sha256 "${INSTALL_SCRIPT}" | \ + awk -v EXPECTED="$INSTALL_SCRIPT_SHA256" \ + '$2!=EXPECTED {print "Install script sha256 " $2 " does not match " EXPECTED; exit 1}' + fi + /bin/bash "${INSTALL_SCRIPT}" 1>&2 +fi + +exec "${HERMIT_EXE}" --level=fatal exec "$0" -- "$@" diff --git a/bin/hermit.hcl b/bin/hermit.hcl new file mode 100644 index 00000000..081cbe83 --- /dev/null +++ b/bin/hermit.hcl @@ -0,0 +1,2 @@ +github-token-auth { +} diff --git a/bin/pip b/bin/pip new file mode 120000 index 00000000..0289f6d3 --- /dev/null +++ b/bin/pip @@ -0,0 +1 @@ +.python3-3.12.3.pkg \ No newline at end of file diff --git a/bin/pip3 b/bin/pip3 new file mode 120000 index 00000000..0289f6d3 --- /dev/null +++ b/bin/pip3 @@ -0,0 +1 @@ +.python3-3.12.3.pkg \ No newline at end of file diff --git a/bin/pip3.12 b/bin/pip3.12 new file mode 120000 index 00000000..0289f6d3 --- /dev/null +++ b/bin/pip3.12 @@ -0,0 +1 @@ +.python3-3.12.3.pkg \ No newline at end of file diff --git a/bin/pydoc3 b/bin/pydoc3 new file mode 120000 index 00000000..0289f6d3 --- /dev/null +++ b/bin/pydoc3 @@ -0,0 +1 @@ +.python3-3.12.3.pkg \ No newline at end of file diff --git a/bin/pydoc3.12 b/bin/pydoc3.12 new file mode 120000 index 00000000..0289f6d3 --- /dev/null +++ b/bin/pydoc3.12 @@ -0,0 +1 @@ +.python3-3.12.3.pkg \ No newline at end of file diff --git a/bin/python b/bin/python new file mode 120000 index 00000000..0289f6d3 --- /dev/null +++ b/bin/python @@ -0,0 +1 @@ +.python3-3.12.3.pkg \ No newline at end of file diff --git a/bin/python3 b/bin/python3 new file mode 120000 index 00000000..0289f6d3 --- /dev/null +++ b/bin/python3 @@ -0,0 +1 @@ +.python3-3.12.3.pkg \ No newline at end of file diff --git a/bin/python3-config b/bin/python3-config new file mode 120000 index 00000000..0289f6d3 --- /dev/null +++ b/bin/python3-config @@ -0,0 +1 @@ +.python3-3.12.3.pkg \ No newline at end of file diff --git a/bin/python3.12 b/bin/python3.12 new file mode 120000 index 00000000..0289f6d3 --- /dev/null +++ b/bin/python3.12 @@ -0,0 +1 @@ +.python3-3.12.3.pkg \ No newline at end of file diff --git a/bin/python3.12-config b/bin/python3.12-config new file mode 120000 index 00000000..0289f6d3 --- /dev/null +++ b/bin/python3.12-config @@ -0,0 +1 @@ +.python3-3.12.3.pkg \ No newline at end of file diff --git a/bin/uv b/bin/uv new file mode 120000 index 00000000..c018ea07 --- /dev/null +++ b/bin/uv @@ -0,0 +1 @@ +.uv-0.4.26.pkg \ No newline at end of file diff --git a/bin/uvx b/bin/uvx new file mode 120000 index 00000000..c018ea07 --- /dev/null +++ b/bin/uvx @@ -0,0 +1 @@ +.uv-0.4.26.pkg \ No newline at end of file