Skip to content

Commit

Permalink
let user install pipenv venv manually
Browse files Browse the repository at this point in the history
  • Loading branch information
laermannjan committed May 30, 2023
1 parent 25fc149 commit 5ef456e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions bin/exec-env
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ source "$RTX_PLUGIN_PATH/bin/utils.sh"
setup_pipenv() {
VIRTUAL_ENV=$(pipenv_venv)
if [[ -z $VIRTUAL_ENV ]]; then
# in a directory without a Pipfile
return
fi

if [[ ! -d $VIRTUAL_ENV ]]; then
"$(pipenv_bin)" install --dev
VIRTUAL_ENV=$(pipenv --venv)
# in a directory with a Pipfile but no virtualenv
echoerr "rtx-pipenv: $VIRTUAL_ENV"
echoerr "rtx-pipenv: install pipenv virtualenv manually 'pipenv install ...'"
return
fi
PIPENV_ACTIVE=1
export VIRTUAL_ENV PIPENV_ACTIVE
Expand Down
4 changes: 3 additions & 1 deletion bin/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@ pipenv_venv() {
echoerr "rtx-pipenv: no Pipfile found at $pipfile"
exit 1
fi
"$(pipenv_bin)" --venv 2>/dev/null

pipenv_venv_dir="$("$(pipenv_bin)" --venv 2>/dev/null)"
echo "${pipenv_venv_dir:-pipfile found without venv}"
}

0 comments on commit 5ef456e

Please sign in to comment.