[SEBA-450] (part 2)
Add tox testing support on additional XOS library modules:
- xos-api
- xos-kafka (has no tests)
- xos-migrate (has no tests)
- xos-synchronizer
Change-Id: I98195bc9747971d3515882d517affe058dd86ac5
diff --git a/lib/xos-api/setup.py b/lib/xos-api/setup.py
index 32c566f..92c7898 100644
--- a/lib/xos-api/setup.py
+++ b/lib/xos-api/setup.py
@@ -1,5 +1,3 @@
-#!/usr/bin/env python
-
# Copyright 2017-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,17 +12,30 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+from __future__ import absolute_import
+
import os
+from shutil import copyfile
+
+from setuptools import setup
from setuptools.command.install import install
-try:
- from xosutil.autoversion_setup import setup_with_auto_version as setup
-except ImportError:
- # xosutil is not installed. Expect this to happen when we build an egg, in which case xosgenx.version will
- # automatically have the right version.
- from setuptools import setup
-from xosapi.version import __version__
+def version():
+ # Copy VERSION file of parent to module directory if not found
+ if not os.path.exists("xosapi/VERSION"):
+ copyfile("../../VERSION", "xosapi/VERSION")
+ with open("xosapi/VERSION") as f:
+ return f.read().strip()
+
+
+def parse_requirements(filename):
+ # parse a requirements.txt file, allowing for blank lines and comments
+ requirements = []
+ for line in open(filename):
+ if line and not line.startswith("#"):
+ requirements.append(line)
+ return requirements
class InstallFixChameleonPermissions(install):
@@ -41,9 +52,11 @@
setup_result = setup(
name="xosapi",
- version=__version__,
+ version=version(),
+ classifiers=["License :: OSI Approved :: Apache Software License"],
+ license="Apache v2",
cmdclass={"install": InstallFixChameleonPermissions},
- description="XOS api client",
+ description="XOS API client",
packages=[
"xosapi.chameleon_client",
"xosapi.chameleon_client.protos",
@@ -51,5 +64,11 @@
"xosapi",
"xosapi.convenience",
],
+ install_requires=parse_requirements("requirements.txt"),
+ include_package_data=True,
+ package_data={
+ "xosapi.chameleon_client.protos": ["*.proto"],
+ "xosapi.chameleon_client.protoc_plugins": ["*.desc"],
+ },
scripts=["xossh"],
)