blob: a925b49c5774f43c131f626fcd77a05a427155d8 [file] [log] [blame]
azvyagintsevec38a1c2018-12-18 16:10:14 +02001#!/bin/bash
2
3set -xe
4
5function _info(){
6 set +x
7 echo -e "=== INFO: pip freeze:"
8 pip freeze | sort
9 echo -e "============================"
10 set -x
11}
12
Hanna Arhipova55cc1292019-01-08 14:22:18 +020013function activate_venv(){
14 set +x
15 if [ -f venv/bin/activate ]; then
16 echo "Activating venv in $(pwd)"
17 source venv/bin/activate && echo "Activated succesfully"
18 else
19 echo "WARNING: No venv found in $(pwd)"
20 return 1
21 fi
22}
23
24echo "$@"
25if [ "$1" = "pytest" ] || [ "$1" = "python" ] || [ "$1" = "pip" ]; then
26 activate_venv &&
27 _info &&
28 exec "$@"
29else
30 exec "$@"
31fi