-
Notifications
You must be signed in to change notification settings - Fork 0
/
licenses.sh
executable file
·38 lines (31 loc) · 1.02 KB
/
licenses.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
#/bin/bash
#/ Description: These script list all installed python modules their version and license
usage() {
grep '^#/' "$0" | cut -c4-
exit 0
}
expr "$*" : ".*--help" > /dev/null && usage
set -eu pipefail
IFS=$'\n\t'
echo "Python Modulename;Version Nr.;License Type" >requirements_license.txt
for i in `cat requirements.txt|awk -F'=' '{print $1}'`
do
IFS=''
ausgabe=$(pip show $i)
name=$i
version=$(grep 'Version:' <<< "$ausgabe"|grep -v "Metadata"|awk -F':' '{print $2}')
license=$(grep -i 'License:' <<< "$ausgabe"|awk -F':' '{print $2}')
IFS=$'\n\t'
echo $name";"$version";"$license >>requirements_license.txt
done
echo "" >>requirements_license.txt
echo "" >>requirements_license.txt
echo "" >>requirements_license.txt
echo "" >>requirements_license.txt
echo "Libirary license report" >>requirements_license.txt
for i in `cat requirements.txt|awk -F'=' '{print $1}'`
do
pip show $i >>requirements_license.txt
echo "" >>requirements_license.txt
echo "" >>requirements_license.txt
done