| 1 | #!/usr/bin/env bash
 | 
| 2 | #
 | 
| 3 | # Run scripts generated by Python's virtualenv under osh.
 | 
| 4 | #
 | 
| 5 | # Usage:
 | 
| 6 | #   ./virtualenv.sh <function name>
 | 
| 7 | 
 | 
| 8 | set -o nounset
 | 
| 9 | set -o pipefail
 | 
| 10 | set -o errexit
 | 
| 11 | 
 | 
| 12 | readonly DIR=_tmp/test-venv
 | 
| 13 | 
 | 
| 14 | create() {
 | 
| 15 |   virtualenv $DIR
 | 
| 16 | }
 | 
| 17 | 
 | 
| 18 | under-bash() {
 | 
| 19 |   # You can see PS1 change here.
 | 
| 20 |   bash -i <<EOF
 | 
| 21 | source $DIR/bin/activate
 | 
| 22 | echo DONE
 | 
| 23 | EOF
 | 
| 24 | }
 | 
| 25 | 
 | 
| 26 | # Hm there seem to be multiple things that don't work here.
 | 
| 27 | under-osh() {
 | 
| 28 |   bin/osh -i <<EOF
 | 
| 29 | source $DIR/bin/activate
 | 
| 30 | echo DONE
 | 
| 31 | EOF
 | 
| 32 | }
 | 
| 33 | 
 | 
| 34 | "$@"
 |