feat: mac install support

This commit is contained in:
2024-03-07 19:33:24 +00:00
parent c0ce6ea961
commit e6a7bec30d
14 changed files with 144 additions and 97 deletions

View File

@@ -7,16 +7,49 @@
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
if ! bin_in_path "pip3"; then
pyenv install 3.9.0
pyenv global 3.9.0
if ! command -v "pip3" &>/dev/null; then
pyenv install 3.12.1
pyenv global 3.12.1
fi
pip install --upgrade pip
pip3 install --upgrade pip
pip install --quiet --upgrade --user pip
pip3 install --quiet --upgrade --user pip
python3 --version
pip3 --version
for dep in $(jq -r ".pip_dependencies[]" $CONFIG); do
pip3 install --upgrade $dep
done
pip_dependencies=(
# docker-compose
# neovim
# "python-language-server[all]"
# pyvim
)
installed_packages=$(pip3 list --format=freeze | awk -F'==' '{print $1}')
pip_dependencies=($(comm -13 <(printf "%s\n" "${installed_packages[@]}" | sort) <(printf "%s\n" "${pip_dependencies[@]}" | sort)))
if [ ${#pip_dependencies[@]} -gt 0 ]; then
pip3 install --quiet --upgrade --user "${pip_dependencies[@]}"
fi
unset installed_packages pip_dependencies PYTHON_KEYRING_BACKEND
if ! command -v "pipx" &>/dev/null; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
sudo apt-get install -qq pipx
elif [[ "$OSTYPE" == "darwin"* ]]; then
brew install pipx
fi
fi
echo "pipx $(pipx --version)"
if ! command -v "poetry" &>/dev/null; then
pipx install poetry
fi
poetry --version
POETRY_PLUGIN="$ZSH/custom/plugins/poetry"
if [ ! -d "$POETRY_PLUGIN" ]; then
mkdir -p $POETRY_PLUGIN
poetry completions zsh > $POETRY_PLUGIN/_poetry
fi