[SEBA-450] (part 1)
Refactoring, python3 compat, and tox tests on:
- xosconfig
- xosgenx
- xosutil
Eliminate use of yaml.load() which is unsafe, switch to yaml.safe_load()
More diagnostics during database migration
Change-Id: I0fae5782fca401603a7c4e4ec2b9269ad24bda97
diff --git a/lib/xos-genx/setup.py b/lib/xos-genx/setup.py
index c294ca4..f1bc5a5 100644
--- a/lib/xos-genx/setup.py
+++ b/lib/xos-genx/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,24 +12,41 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-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 __future__ import absolute_import
-from xosgenx.version import __version__
+import os
+from shutil import copyfile
+
+from setuptools import setup
+
+
+def version():
+ # Copy VERSION file of parent to module directory if not found
+ if not os.path.exists("xosgenx/VERSION"):
+ copyfile("../../VERSION", "xosgenx/VERSION")
+ with open("xosgenx/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 line.startswith("#"):
+ requirements.append(line)
+ return requirements
+
setup(
- name="XosGenX",
- version=__version__,
+ name="xosgenx",
+ version=version(),
description="XOS Generative Toolchain",
author="Sapan Bhatia, Matteo Scandolo",
author_email="sapan@opennetworking.org, teo@opennetworking.org",
+ classifiers=["License :: OSI Approved :: Apache Software License"],
+ license="Apache v2",
packages=["xosgenx"],
scripts=["bin/xosgenx"],
+ install_requires=parse_requirements("requirements.txt"),
include_package_data=True,
- # TODO add all deps to the install_requires section
- install_requires=["inflect>=1.0.1", "astunparse>=1.5.0"],
)