mirror of
https://gitea.blesmrt.net/mikaela/scripts.git
synced 2025-08-21 05:47:20 +02:00
Compare commits
No commits in common. "2e0e86bc2e5c7c071a34d9e169f7ec3e0f6e7bfe" and "fccdceda633389200c84425fad4b9dca33b5b3a6" have entirely different histories.
2e0e86bc2e
...
fccdceda63
@ -1,19 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# This is a noteish on how to pre-commit on SteamOS. Or it was, but then I
|
# This is a noteish on how to pre-commit on SteamOS
|
||||||
# decided that pipx is a thing that I could put into the venv more reasonably
|
|
||||||
# and feel less bad about abusing it O:)
|
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
# In case there is some valid reason to use different Python
|
|
||||||
PYTHON=python3
|
|
||||||
|
|
||||||
cd ~
|
cd ~
|
||||||
mkdir -p ~/.local/bin/
|
mkdir -p ~/.local/bin/
|
||||||
|
|
||||||
# My pre-commit configuration expects to find a pypy which SteamOS doesn't
|
# My pre-commit configuration expects to find a pypy
|
||||||
# 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!
|
|
||||||
if ! hash pypy 2>/dev/null; then
|
if ! hash pypy 2>/dev/null; then
|
||||||
ln -sf /usr/bin/python ~/.local/bin/pypy
|
ln -sf /usr/bin/python ~/.local/bin/pypy
|
||||||
fi
|
fi
|
||||||
@ -22,19 +14,10 @@ if ! hash pypy3 2>/dev/null; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p ~/venv
|
mkdir -p ~/venv
|
||||||
$PYTHON -m venv ~/venv
|
python3 -m venv ~/venv
|
||||||
. ~/venv/bin/activate
|
. ~/venv/bin/activate
|
||||||
$PYTHON -m pip install pip --upgrade
|
python3 -m pip install pip --upgrade
|
||||||
$PYTHON -m pip install pipx --upgrade
|
python3 -m pip install pre-commit --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
|
|
||||||
|
|
||||||
# Removes duplicates from $PATH. Copied from https://unix.stackexchange.com/a/14896
|
# 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]}')
|
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"
|
printf "Remember to apply the following somewhere appropiate:\nPATH=$PATH"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user