Skip to content

Commit

Permalink
Merge pull request #2 from laermannjan/main
Browse files Browse the repository at this point in the history
Allow global pipenv installation + let user install venv manually
  • Loading branch information
jdx authored Nov 28, 2024
2 parents 36ff901 + 5ef456e commit a38791b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
13 changes: 10 additions & 3 deletions bin/exec-env
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@ source "$RTX_PLUGIN_PATH/bin/utils.sh"

setup_pipenv() {
VIRTUAL_ENV=$(pipenv_venv)
if [[ -z $VIRTUAL_ENV || ! -d $VIRTUAL_ENV ]]; then
"$(pipenv_bin)" install --dev
VIRTUAL_ENV=$(pipenv --venv)
if [[ -z $VIRTUAL_ENV ]]; then
# in a directory without a Pipfile
return
fi

if [[ ! -d $VIRTUAL_ENV ]]; then
# 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
RTX_ADD_PATH="$VIRTUAL_ENV/bin"
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 a38791b

Please sign in to comment.