direnv-first venv creation.
This commit is contained in:
parent
799ab218ad
commit
c174ac7e17
22
.bashrc
22
.bashrc
|
@ -175,18 +175,20 @@ e()
|
||||||
|
|
||||||
venv()
|
venv()
|
||||||
{
|
{
|
||||||
# direnv-enabled venv creation.
|
# direnv-first venv creation.
|
||||||
if ! [[ -d .venv ]]
|
if [[ -f .envrc ]]
|
||||||
then
|
then
|
||||||
if [[ -f .envrc ]]
|
echo '`.envrc` file already exists!'
|
||||||
then
|
return
|
||||||
echo '`.venv` does not exists but `.envrc` file already exists!'
|
|
||||||
echo "Human? Untangle it, please."
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
"python$1" -m venv .venv
|
|
||||||
echo 'PATH=$(pwd)/.venv/bin/:$PATH' > .envrc
|
|
||||||
fi
|
fi
|
||||||
|
cat >.envrc <<EOF
|
||||||
|
if ! [[ -d .venv ]]; then
|
||||||
|
echo "Creating venv..."
|
||||||
|
python$1 -m venv .venv
|
||||||
|
fi
|
||||||
|
PATH=$(pwd)/.venv/bin/:$PATH
|
||||||
|
EOF
|
||||||
|
direnv allow .
|
||||||
}
|
}
|
||||||
|
|
||||||
pip-common()
|
pip-common()
|
||||||
|
|
Loading…
Reference in New Issue