blob: b120ebe7d18784cf71a528a874a370ff43b41a76 [file] [log] [blame]
Hanna Arhipova16e93fb2019-01-23 19:03:01 +02001#!/bin/bash
2
3# This file used as an interface for automatic activating of virtualenv.
4# Should be placed into PATH
5# Example: with_venv.sh python --version
6
7set -xe
8
9function _info(){
10 set +x
11 echo -e "===== virtualenv info: ====="
12 python --version
13 pip freeze | sort
14 echo -e "============================"
15 set -x
16}
17
18function activate_venv(){
19 set +x
20 if [ -f venv/bin/activate ]; then
21 echo "Activating venv in $(pwd)"
22 source venv/bin/activate && echo "Activated succesfully"
23 else
24 echo "WARNING: No venv found in $(pwd)"
25 return 1
26 fi
27 set -x
28}
29
30activate_venv &&
31_info &&
32exec "$@"