Compare commits

..

No commits in common. "2e0e86bc2e5c7c071a34d9e169f7ec3e0f6e7bfe" and "fccdceda633389200c84425fad4b9dca33b5b3a6" have entirely different histories.

View File

@ -1,19 +1,11 @@
#!/usr/bin/env bash
# This is a noteish on how to pre-commit on SteamOS. Or it was, but then I
# decided that pipx is a thing that I could put into the venv more reasonably
# and feel less bad about abusing it O:)
# This is a noteish on how to pre-commit on SteamOS
set -x
# In case there is some valid reason to use different Python
PYTHON=python3
cd ~
mkdir -p ~/.local/bin/
# My pre-commit configuration expects to find a pypy which SteamOS doesn't
# come with and it was the original motivation for this script, so it's
# difficult to start changing anything here. If you don't want it, just
# install pypy or symlink it in path yourself!
# My pre-commit configuration expects to find a pypy
if ! hash pypy 2>/dev/null; then
ln -sf /usr/bin/python ~/.local/bin/pypy
fi
@ -22,19 +14,10 @@ if ! hash pypy3 2>/dev/null; then
fi
mkdir -p ~/venv
$PYTHON -m venv ~/venv
python3 -m venv ~/venv
. ~/venv/bin/activate
$PYTHON -m pip install pip --upgrade
$PYTHON -m pip install pipx --upgrade
$PYTHON -m pipx install pre-commit
$PYTHON -m pipx upgrade-all
# As this script claims to be pre-commit on SteamOS, let's do it properly all
# the way!
mkdir -p ~/.git-template
git config --global init.templatedir ~/.git-template
pre-commit init-templatedir ~/.git-template
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"