733b1170547b7ecc11a12dfd80a3808d4bae95c0

Author
Maximilian Staab <ms@abusix.com>
Committer
Maximilian Staab <ms@abusix.com>
Date

Message

Change poetry venv detection

Diff

 1diff --git a/autoswitch_virtualenv.plugin.zsh b/autoswitch_virtualenv.plugin.zsh
 2index 071a2d617083c6ebd4232ac53ef3fa52d3f4c5d6..4171b828044e5b823e38b5ba7710d1ff70c90297 100644
 3--- a/autoswitch_virtualenv.plugin.zsh
 4+++ b/autoswitch_virtualenv.plugin.zsh
 5@@ -142,17 +142,9 @@ function _check_path()
 6 function _activate_poetry() {
 7     # check if any environments exist before trying to activate
 8     # if env list is empty, then no environment exists that can be activated
 9-    name="$(poetry env list | cut -d' ' -f1)"
10+    local name="$(poetry env list --full-path | cut -d' ' -f1)"
11     if [[ -n "$name" ]]; then
12-        local venv_path
13-        # Temporary work around until we figure out a better way to
14-        # correctly determine the location of virtualenvs in poetry
15-        if [[ "$(uname)" == "Darwin" ]]; then
16-            venv_path="$HOME/Library/Caches/pypoetry/virtualenvs/$name"
17-        else
18-            venv_path="$HOME/.cache/pypoetry/virtualenvs/$name"
19-        fi
20-        _maybeworkon "$venv_path" "poetry"
21+        _maybeworkon "$name" "poetry"
22         return 0
23     fi
24     return 1
25@@ -177,7 +169,7 @@ function check_venv()
26 
27     # Get the $AUTOSWITCH_FILE, scanning parent directories
28     local venv_path="$(_check_path "$PWD")"
29-
30+    
31     if [[ -n "$venv_path" ]]; then
32 
33         /usr/bin/stat --version &> /dev/null