2023-10-05 18:12:37 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# This is a noteish on how to pre-commit on SteamOS
|
|
|
|
set -x
|
|
|
|
|
|
|
|
cd ~
|
|
|
|
mkdir -p ~/.local/bin/
|
2023-10-06 06:55:06 +02:00
|
|
|
|
2023-10-05 18:12:37 +02:00
|
|
|
# My pre-commit configuration expects to find a pypy
|
2023-10-06 06:55:06 +02:00
|
|
|
if ! hash pypy 2>/dev/null; then
|
|
|
|
ln -sf /usr/bin/python ~/.local/bin/pypy
|
|
|
|
fi
|
|
|
|
if ! hash pypy3 2>/dev/null; then
|
|
|
|
ln -sf /usr/bin/python3 ~/.local/bin/pypy3
|
|
|
|
fi
|
2023-10-05 18:12:37 +02:00
|
|
|
|
|
|
|
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
|