blob: 00e5e3c30a40c0725d77f9a1c34e54866caae4b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
diff --git a/bin/pyenv-virtualenv-prefix b/bin/pyenv-virtualenv-prefix
index aa71777..bbe5871 100755
--- a/bin/pyenv-virtualenv-prefix
+++ b/bin/pyenv-virtualenv-prefix
@@ -6,7 +6,21 @@
set -e
[ -n "$PYENV_DEBUG" ] && set -x
-. "${BASH_SOURCE%/*}"/../libexec/pyenv-virtualenv-realpath
+if [ -L "${BASH_SOURCE}" ]; then
+ READLINK=$(type -p greadlink readlink | head -1)
+ if [ -z "$READLINK" ]; then
+ echo "pyenv: cannot find readlink - are you missing GNU coreutils?" >&2
+ exit 1
+ fi
+ resolve_link() {
+ $READLINK -f "$1"
+ }
+ script_path=$(resolve_link ${BASH_SOURCE})
+else
+ script_path=${BASH_SOURCE}
+fi
+
+. ${script_path%/*}/../libexec/pyenv-virtualenv-realpath
if [ -z "$PYENV_ROOT" ]; then
PYENV_ROOT="${HOME}/.pyenv"
diff --git a/bin/pyenv-virtualenvs b/bin/pyenv-virtualenvs
index 173278b..b441e78 100755
--- a/bin/pyenv-virtualenvs
+++ b/bin/pyenv-virtualenvs
@@ -7,7 +7,21 @@
set -e
[ -n "$PYENV_DEBUG" ] && set -x
-. "${BASH_SOURCE%/*}"/../libexec/pyenv-virtualenv-realpath
+if [ -L "${BASH_SOURCE}" ]; then
+ READLINK=$(type -p greadlink readlink | head -1)
+ if [ -z "$READLINK" ]; then
+ echo "pyenv: cannot find readlink - are you missing GNU coreutils?" >&2
+ exit 1
+ fi
+ resolve_link() {
+ $READLINK -f "$1"
+ }
+ script_path=$(resolve_link ${BASH_SOURCE})
+else
+ script_path=${BASH_SOURCE}
+fi
+
+. ${script_path%/*}/../libexec/pyenv-virtualenv-realpath
if [ -z "$PYENV_ROOT" ]; then
PYENV_ROOT="${HOME}/.pyenv"
|