b36c90d9abd2fd2ffe53d19b11e47077dfdb38a8

Author
Diego Costa R <62116423+diegocostares@users.noreply.github.com>
Committer
GitHub <noreply@github.com>
Date

Message

feat(autoenv): macOS compatibility, add more dirs (#11724)

Co-authored-by: Carlo Sala <carlosalag@protonmail.com>

Diff

 1diff --git a/plugins/autoenv/autoenv.plugin.zsh b/plugins/autoenv/autoenv.plugin.zsh
 2index 229a8a83404de0450f0d07d428684a8c23adbe9f..cbf7cefbbc00a3c60e651550afcd80cb82bbb416 100644
 3--- a/plugins/autoenv/autoenv.plugin.zsh
 4+++ b/plugins/autoenv/autoenv.plugin.zsh
 5@@ -17,9 +17,13 @@ if ! type autoenv_init >/dev/null; then
 6       /usr/local/bin
 7       /usr/share/autoenv-git
 8       ~/Library/Python/bin
 9+      .venv/bin
10+      venv/bin
11+      env/bin
12+      .env/bin
13     )
14     for d ( $install_locations ); do
15-      if [[ -e $d/activate.sh ]]; then
16+      if [[ -e $d/activate || -e $d/activate.sh ]]; then
17         autoenv_dir=$d
18         break
19       fi
20@@ -29,13 +33,13 @@ if ! type autoenv_init >/dev/null; then
21   # Look for Homebrew path as a last resort
22   if [[ -z "$autoenv_dir" ]] && (( $+commands[brew] )); then
23     d=$(brew --prefix)/opt/autoenv
24-    if [[ -e $d/activate.sh ]]; then
25+    if [[ -e $d/activate || -e $d/activate.sh ]]; then
26       autoenv_dir=$d
27     fi
28   fi
29 
30   # Complain if autoenv is not installed
31-  if [[ -z $autoenv_dir ]]; then 
32+  if [[ -z $autoenv_dir ]]; then
33     cat <<END >&2
34 -------- AUTOENV ---------
35 Could not locate autoenv installation.
36@@ -46,7 +50,11 @@ END
37     return 1
38   fi
39   # Load autoenv
40-  source $autoenv_dir/activate.sh
41+  if [[ -e $autoenv_dir/activate ]];
42+    source $autoenv_dir/activate
43+  else
44+    source $autoenv_dir/activate.sh
45+  fi
46 fi
47 }
48 [[ $? != 0 ]] && return $?