David Blume commited on 2021-05-01 14:47:34
Showing 1 changed files, with 6 additions and 13 deletions.
| ... | ... |
@@ -101,23 +101,16 @@ concept() {
|
| 101 | 101 |
} |
| 102 | 102 |
|
| 103 | 103 |
venv() {
|
| 104 |
- # From https://twitter.com/gvanrossum/status/1319328122618048514 |
|
| 105 |
- if [ -n "$1" ]; then |
|
| 106 |
- VENV=./venv-$1 |
|
| 107 |
- if [ -f $VENV/bin/activate ]; then |
|
| 104 |
+ # Inspired by https://twitter.com/gvanrossum/status/1319328122618048514 |
|
| 108 | 105 |
if hash deactivate 2>/dev/null; then |
| 109 | 106 |
deactivate |
| 110 | 107 |
fi |
| 111 |
- source $VENV/bin/activate |
|
| 112 |
- else |
|
| 113 |
- echo "Creating $1 at $VENV" |
|
| 114 |
- python3 -m venv $VENV |
|
| 115 |
- source $VENV/bin/activate |
|
| 116 |
- fi |
|
| 117 |
- else |
|
| 118 |
- if hash deactivate 2>/dev/null; then |
|
| 119 |
- deactivate |
|
| 108 |
+ if [[ $1 ]]; then |
|
| 109 |
+ if [ ! -f $1/bin/activate ]; then |
|
| 110 |
+ echo "Creating with: python3 -m venv $1" |
|
| 111 |
+ python3 -m venv $1 |
|
| 120 | 112 |
fi |
| 113 |
+ source $1/bin/activate |
|
| 121 | 114 |
fi |
| 122 | 115 |
} |
| 123 | 116 |
|
| 124 | 117 |