From dfd85dece56f1b5f1addac121dcd5438f2c3774b Mon Sep 17 00:00:00 2001 From: SerenaFeng Date: Fri, 25 Aug 2017 17:56:55 +0800 Subject: 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 --- testapi/.gitignore | 3 +++ testapi/docker/Dockerfile | 2 +- testapi/install.sh | 30 ------------------------------ testapi/setup.py | 9 ++++++++- 4 files changed, 12 insertions(+), 32 deletions(-) delete mode 100755 testapi/install.sh (limited to 'testapi') 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 ] - -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) -- cgit 1.2.3-korg