295dd262c9e0519159ca397f74027d50a555e336
[functest.git] / testcases / features / sfc / tacker_client_install.sh
1 MYDIR=$(dirname $(readlink -f "$0"))
2 CLIENT=$(echo python-python-tackerclient_*_all.deb)
3 CLIREPO="tacker-client"
4
5 # Function checks whether a python egg is available, if not, installs
6 function chkPPkg () {
7     PKG="$1"
8     IPPACK=$(python - <<'____EOF'
9 import pip
10 from os.path import join
11 for package in pip.get_installed_distributions():
12     print(package.location)
13     print(join(package.location, *package._get_metadata("top_level.txt")))
14 ____EOF
15 )
16     echo "$IPPACK" | grep -q "$PKG"
17     if [ $? -ne 0 ];then
18         pip install "$PKG"
19     fi
20 }
21
22 function envSetup () {
23     apt-get install -y python-all debhelper
24     chkPPkg stdeb
25     chkCrudini
26 }
27
28 # Function installs python-tackerclient from github
29 function deployTackerClient() {
30     cd $MYDIR
31     git clone -b 'SFC_refactor' https://github.com/trozet/python-tackerclient.git $CLIREPO
32     cd $CLIREPO
33     python setup.py --command-packages=stdeb.command bdist_deb
34     cd "deb_dist"
35     CLIENT=$(echo python-python-tackerclient_*_all.deb)
36     cp $CLIENT $MYDIR
37     dpkg -i "${MYDIR}/${CLIENT}"
38 }
39
40 envSetup
41 deployTackerClient