projects
/
dotfiles
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2d913d0
)
Fix the issue where bashrc always activates in subdirectories of virtual environments
author
David Kerkeslager
<kerkeslager@gmail.com>
Mon, 19 Feb 2018 19:11:20 +0000
(14:11 -0500)
committer
David Kerkeslager
<kerkeslager@gmail.com>
Mon, 19 Feb 2018 19:11:38 +0000
(14:11 -0500)
.bashrc
patch
|
blob
|
history
diff --git
a/.bashrc
b/.bashrc
index
a8ebce5
..
399963c
100644
(file)
--- a/
.bashrc
+++ b/
.bashrc
@@
-95,12
+95,16
@@
get_env() {
fi
}
+get_absolute_path() {
+ python3 -c "import os; print(os.path.realpath('$1'))"
+}
+
on_prompt() {
# Load a virtualenv environment if it exists in a file named .env
env_folder=$(get_env $(pwd))
if [ -d "$env_folder" ] ; then
-
if [[ $VIRTUAL_ENV != $env_folder
]] ; then
+
if [[ $VIRTUAL_ENV != $(get_absolute_path $env_folder)
]] ; then
echo "Activating env '$env_folder'"
source "$env_folder/bin/activate"
fi