tools tools tools!

This commit is contained in:
Letter N
2021-01-31 10:47:25 +08:00
parent 945599e937
commit 0901cf9f10
105 changed files with 1612 additions and 8467 deletions
Regular → Executable
+12 -27
View File
@@ -1,32 +1,17 @@
#!/bin/sh
# `sh` must be used here instead of `bash` to support GitHub Desktop.
set -e
# Strip the "App Execution Aliases" from $PATH. Even if the user installed
# Python using the Windows Store on purpose, these aliases always generate
# "Permission denied" errors when sh.exe tries to invoke them.
PATH=$(echo "$PATH" | tr ":" "\n" | grep -v "AppData/Local/Microsoft/WindowsApps" | tr "\n" ":")
# Try to find a Python executable.
if command -v python3 >/dev/null 2>&1; then
PY=python3
elif command -v python >/dev/null 2>&1; then
PY=python
elif command -v py >/dev/null 2>&1; then
PY="py -3"
if [ "$*" = "-m precommit" ]; then
echo "Hooks are being updated..."
echo "Details: https://github.com/tgstation/tgstation/pull/55658"
if [ "$(uname -o)" = "Msys" ]; then
tools/hooks/Install.bat
else
tools/hooks/install.sh
fi
echo "---------------"
exec tools/hooks/pre-commit.hook
else
echo "Please install Python from https://www.python.org/downloads/"
echo "tools/hooks/python.sh is replaced by tools/bootstrap/python"
echo "Details: https://github.com/tgstation/tgstation/pull/55658"
exit 1
fi
# Deduce the path separator and add the mapmerge package to the search path.
PATHSEP=$($PY - <<'EOF'
import sys, os
if sys.version_info.major != 3 or sys.version_info.minor < 6:
sys.stderr.write("Python 3.6 or later is required, but you have:\n" + sys.version + "\n")
exit(1)
print(os.pathsep)
EOF
)
export PYTHONPATH=tools/mapmerge2/${PATHSEP}${PYTHONPATH}
exec $PY "$@"