leverage setup.py directly to install TestAPI 31/40231/2
authorSerenaFeng <feng.xiaowei@zte.com.cn>
Fri, 25 Aug 2017 09:56:55 +0000 (17:56 +0800)
committerSerenaFeng <feng.xiaowei@zte.com.cn>
Fri, 25 Aug 2017 10:05:51 +0000 (18:05 +0800)
1. delete additional script install.sh
2. using 'python setup.py install' directly to install
TestAPI, as traditional python project do

Change-Id: Ifcdee7b2bae2553f523a722bff794c40d20f81cc
Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
utils/test/testapi/.gitignore
utils/test/testapi/docker/Dockerfile
utils/test/testapi/install.sh [deleted file]
utils/test/testapi/setup.py

index c7b63b5..00f8a03 100644 (file)
@@ -1,4 +1,7 @@
 AUTHORS
 ChangeLog
 setup.cfg-e
+opnfv_testapi/static
+build
+*.egg-info
 
index 5311f35..a46fce2 100644 (file)
@@ -47,5 +47,5 @@ RUN git clone https://gerrit.opnfv.org/gerrit/releng /home/releng
 
 WORKDIR /home/releng/utils/test/testapi/
 RUN pip install -r requirements.txt
-RUN bash install.sh
+RUN python setup.py install
 CMD ["bash", "docker/start-server.sh"]
diff --git a/utils/test/testapi/install.sh b/utils/test/testapi/install.sh
deleted file mode 100755 (executable)
index d470e38..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/bash
-
-usage="
-Script to install opnfv_tesgtapi automatically.
-This script should be run under root.
-
-usage:
-    bash $(basename "$0") [-h|--help] [-t <test_name>]
-
-where:
-    -h|--help         show this help text"
-
-# Ref :-  https://openstack.nimeyo.com/87286/openstack-packaging-all-definition-data-files-config-setup
-if [ -z "$VIRTUAL_ENV" ];
-then
-    if [[ $(whoami) != "root" ]];
-    then
-        echo "Error: This script must be run as root!"
-        exit 1
-    fi
-else
-    sed -i -e 's#/etc/opnfv_testapi =#etc/opnfv_testapi =#g' setup.cfg
-fi
-
-cp -fr 3rd_party/static opnfv_testapi/static
-python setup.py install
-rm -fr opnfv_testapi/static
-if [ ! -z "$VIRTUAL_ENV" ]; then
-    sed -i -e 's#etc/opnfv_testapi =#/etc/opnfv_testapi =#g' setup.cfg
-fi
\ No newline at end of file
index f689cb3..dd52373 100644 (file)
@@ -1,5 +1,7 @@
-import setuptools
+import os
+import subprocess
 
+import setuptools
 
 __author__ = 'serena'
 
@@ -8,6 +10,11 @@ try:
 except ImportError:
     pass
 
+dirpath = os.path.dirname(os.path.abspath(__file__))
+subprocess.call(['ln', '-s',
+                 '{}/3rd_party/static'.format(dirpath),
+                 '{}/opnfv_testapi/static'.format(dirpath)])
+
 setuptools.setup(
     setup_requires=['pbr==2.0.0'],
     pbr=True)