summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorSerena Feng <feng.xiaowei@zte.com.cn>2017-09-05 08:24:46 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-09-05 08:24:46 +0000
commitca6539a8f8c7f608623cdd578d2d606322f06370 (patch)
tree2520700acb7a11aa485c5878e7a3a553cbec33d1 /utils
parentab38b8924b8b39eb44201f9bfa41f009a3eea0a1 (diff)
parent0b087ed645c0cd125cf5c6198f2bf115cb4de4b0 (diff)
Merge "bugfix: leverage data_files to stop hacking setup.py"
Diffstat (limited to 'utils')
-rw-r--r--utils/test/testapi/MANIFEST.in1
-rw-r--r--utils/test/testapi/etc/config.ini3
-rw-r--r--utils/test/testapi/opnfv_testapi/cmd/server.py2
-rw-r--r--utils/test/testapi/opnfv_testapi/common/config.py4
-rw-r--r--utils/test/testapi/opnfv_testapi/router/url_mappings.py2
-rw-r--r--utils/test/testapi/opnfv_testapi/ui/root.py2
-rw-r--r--utils/test/testapi/setup.cfg15
-rw-r--r--utils/test/testapi/setup.py9
8 files changed, 11 insertions, 27 deletions
diff --git a/utils/test/testapi/MANIFEST.in b/utils/test/testapi/MANIFEST.in
new file mode 100644
index 000000000..0ba1808ba
--- /dev/null
+++ b/utils/test/testapi/MANIFEST.in
@@ -0,0 +1 @@
+recursive-include 3rd_party \ No newline at end of file
diff --git a/utils/test/testapi/etc/config.ini b/utils/test/testapi/etc/config.ini
index db0e191d1..a7d8da622 100644
--- a/utils/test/testapi/etc/config.ini
+++ b/utils/test/testapi/etc/config.ini
@@ -21,6 +21,9 @@ authenticate = False
[ui]
url = http://localhost:8000
+# this path should be the seem with data_files installation path
+static_path = /usr/local/share/opnfv_testapi
+
[lfid]
# Linux Foundation cas URL
cas_url = https://identity.linuxfoundation.org/cas/
diff --git a/utils/test/testapi/opnfv_testapi/cmd/server.py b/utils/test/testapi/opnfv_testapi/cmd/server.py
index 50ac049a0..b7d3caa20 100644
--- a/utils/test/testapi/opnfv_testapi/cmd/server.py
+++ b/utils/test/testapi/opnfv_testapi/cmd/server.py
@@ -38,7 +38,7 @@ from opnfv_testapi.tornado_swagger import swagger
def make_app():
swagger.docs(base_url=CONF.ui_url,
- static_path=CONF.static_path)
+ static_path=CONF.ui_static_path)
return swagger.Application(
url_mappings.mappings,
debug=CONF.api_debug,
diff --git a/utils/test/testapi/opnfv_testapi/common/config.py b/utils/test/testapi/opnfv_testapi/common/config.py
index 03515addd..140e49283 100644
--- a/utils/test/testapi/opnfv_testapi/common/config.py
+++ b/utils/test/testapi/opnfv_testapi/common/config.py
@@ -20,10 +20,6 @@ class Config(object):
self._set_config_file()
self._parse()
self._parse_per_page()
- self.static_path = os.path.join(
- os.path.dirname(os.path.normpath(__file__)),
- os.pardir,
- 'static')
def _parse(self):
if not os.path.exists(self.config_file):
diff --git a/utils/test/testapi/opnfv_testapi/router/url_mappings.py b/utils/test/testapi/opnfv_testapi/router/url_mappings.py
index be6240e70..c038e88cc 100644
--- a/utils/test/testapi/opnfv_testapi/router/url_mappings.py
+++ b/utils/test/testapi/opnfv_testapi/router/url_mappings.py
@@ -72,7 +72,7 @@ mappings = [
# static path
(r'/(.*\.(css|png|gif|js|html|json|map|woff2|woff|ttf))',
tornado.web.StaticFileHandler,
- {'path': CONF.static_path}),
+ {'path': CONF.ui_static_path}),
(r'/', root.RootHandler),
(r'/api/v1/auth/signin', sign.SigninHandler),
diff --git a/utils/test/testapi/opnfv_testapi/ui/root.py b/utils/test/testapi/opnfv_testapi/ui/root.py
index 069ad5e93..576cbddcf 100644
--- a/utils/test/testapi/opnfv_testapi/ui/root.py
+++ b/utils/test/testapi/opnfv_testapi/ui/root.py
@@ -5,7 +5,7 @@ from opnfv_testapi.resources import handlers
class RootHandler(handlers.GenericApiHandler):
def get_template_path(self):
- return CONF.static_path
+ return CONF.ui_static_path
@check.login
def get(self):
diff --git a/utils/test/testapi/setup.cfg b/utils/test/testapi/setup.cfg
index ab1ef553e..030e05acc 100644
--- a/utils/test/testapi/setup.cfg
+++ b/utils/test/testapi/setup.cfg
@@ -23,18 +23,10 @@ setup-hooks =
[files]
packages =
opnfv_testapi
-package_data =
- opnfv_testapi =
- static/*.*
- static/*/*.*
- static/*/*/*.*
- static/*/*/*/*.*
- static/*/*/*/*/*.*
- static/*/*/*/*/*/*.*
- static/*/*/*/*/*/*/*.*
+
data_files =
- /etc/opnfv_testapi =
- etc/config.ini
+ etc/opnfv_testapi = etc/config.ini
+ /usr/local/share/opnfv_testapi = 3rd_party/static/*
[entry_points]
console_scripts =
@@ -44,4 +36,3 @@ console_scripts =
tag_build =
tag_date = 0
tag_svn_revision = 0
-
diff --git a/utils/test/testapi/setup.py b/utils/test/testapi/setup.py
index dd52373fd..f9d95a32d 100644
--- a/utils/test/testapi/setup.py
+++ b/utils/test/testapi/setup.py
@@ -1,6 +1,3 @@
-import os
-import subprocess
-
import setuptools
__author__ = 'serena'
@@ -10,11 +7,7 @@ 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'],
+ setup_requires=['pbr>=2.0.0'],
pbr=True)