forked from EricssonResearch/calvin-base
-
Notifications
You must be signed in to change notification settings - Fork 0
/
genreq.sh
39 lines (34 loc) · 956 Bytes
/
genreq.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
if [ "$1" == "-c" ]; then
VENV=$(mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir')
virtualenv $VENV
source $VENV/bin/activate
sed -i.bak 's|[><=].*||' test-requirements.txt requirements.txt
pip install -r test-requirements.txt -r requirements.txt > /dev/null
fi
if [ ! -z "$VENV" ]; then
source $VENV/bin/activate
fi
echo
# generate
echo "cat << EOF > requirements.txt"
for a in $(cat requirements.txt)
do
TAG=$(pip freeze | grep "^$a==")
#NAME=$(pip show $a | grep "^Name: " | sed 's|Name: \(.\+\)|\1|')
#VERSION=$(pip show $a | grep "^Version: " | sed 's|Version: \(.\+\)|\1|')
echo $TAG
done
echo "EOF"
echo
echo "cat << EOF > test-requirements.txt"
for a in $(cat test-requirements.txt)
do
TAG=$(pip freeze | grep "^$a==")
#NAME=$(pip show $a | grep "^Name: " | sed 's|Name: \(.\+\)|\1|')
#VERSION=$(pip show $a | grep "^Version: " | sed 's|Version: \(.\+\)|\1|')
echo $TAG
done
echo "EOF"
if [ ! -z "$VENV" ]; then
deactivate
fi