summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerenaFeng <feng.xiaowei@zte.com.cn>2017-08-25 17:56:55 +0800
committerSerenaFeng <feng.xiaowei@zte.com.cn>2017-08-25 18:05:51 +0800
commitdfd85dece56f1b5f1addac121dcd5438f2c3774b (patch)
tree4084b9035019af1386e1e1c90678a6fdb0228375
parent2eb503cb2e3496131c21954506da58b056c8fb46 (diff)
leverage setup.py directly to install TestAPI
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>
-rw-r--r--testapi/.gitignore3
-rw-r--r--testapi/docker/Dockerfile2
-rwxr-xr-xtestapi/install.sh30
-rw-r--r--testapi/setup.py9
4 files changed, 12 insertions, 32 deletions
diff --git a/testapi/.gitignore b/testapi/.gitignore
index c7b63b5..00f8a03 100644
--- a/testapi/.gitignore
+++ b/testapi/.gitignore
@@ -1,4 +1,7 @@
AUTHORS
ChangeLog
setup.cfg-e
+opnfv_testapi/static
+build
+*.egg-info
diff --git a/testapi/docker/Dockerfile b/testapi/docker/Dockerfile
index 5311f35..a46fce2 100644
--- a/testapi/docker/Dockerfile
+++ b/testapi/docker/Dockerfile
@@ -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/testapi/install.sh b/testapi/install.sh
deleted file mode 100755
index d470e38..0000000
--- a/testapi/install.sh
+++ /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
diff --git a/testapi/setup.py b/testapi/setup.py
index f689cb3..dd52373 100644
--- a/testapi/setup.py
+++ b/testapi/setup.py
@@ -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)