From 8169387dd289309657a0d6446aa6a5f5109fe853 Mon Sep 17 00:00:00 2001 From: Aminda Suomalainen Date: Thu, 5 Oct 2023 19:12:37 +0300 Subject: [PATCH] steamos-venv-pre-commit.bash: evil note on pre-committing on SteamOS --- bash/steamos-venv-pre-commit.bash | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 bash/steamos-venv-pre-commit.bash diff --git a/bash/steamos-venv-pre-commit.bash b/bash/steamos-venv-pre-commit.bash new file mode 100755 index 0000000..5fb7413 --- /dev/null +++ b/bash/steamos-venv-pre-commit.bash @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# This is a noteish on how to pre-commit on SteamOS +set -x + +cd ~ +mkdir -p ~/.local/bin/ +# My pre-commit configuration expects to find a pypy +ln -sf /usr/bin/python ~/.local/bin/pypy +ln -sf /usr/bin/python3 ~/.local/bin/pypy3 + +mkdir -p ~/venv +python3 -m venv ~/venv +. ~/venv/bin/activate +python3 -m pip install pip --upgrade +python3 -m pip install pre-commit --upgrade +# Removes duplicates from $PATH. Copied from https://unix.stackexchange.com/a/14896 +PATH=$(echo "$PATH" | awk -v RS=':' -v ORS=":" '!a[$1]++{if (NR > 1) printf ORS; printf $a[$1]}') +printf "Remember to apply the following somewhere appropiate:\nPATH=$PATH" + +set +x