#! /bin/bash -- [ ! -z "${GREZZO_1577142078}" ] && return; GREZZO_1577142078=0 . "$(this_script_path)/pip.sh" . "$(this_script_path)/curl.sh" function feat_add_poetry() { feat_needed "pip" feat_needed "curl" curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python . "$HOME/.poetry/env" } function poetry_initialized() { poetry check >/dev/null 2>&1 } function poetry_feat_added() { poetry show | cut -f1 -d ' ' | grep -q ^"$1"$ } function poetry_feat_missing() { if feat_missing "pip"; then true else if feat_missing "poetry"; then true else if ! poetry_initialized; then true fi ! poetry run python -c "import $1" >/dev/null 2>&1 fi fi } function poetry_feat_needed() { feat_needed "poetry" FEAT="$1" if ! poetry_initialized; then poetry init -n fi if poetry_feat_added "$FEAT"; then if poetry_feat_missing "$FEAT"; then poetry install fi else if type "poetry_feat_add_$FEAT" > /dev/null 2>&1 ; then eval "poetry_feat_add_$FEAT" else poetry_feat_add "$FEAT" fi fi } function poetry_feat_add() { poetry add "$1" } unset DOVE