[sonic-yang-mgmt/setup.py]: Removing the part where build dependencies are installed in setup.py. (#4657)
Changes: -- Removing the part where build dependencies are installed in setup.py. -- Adding build dependencies in corresponsing rules\..*.mk file. Signed-off-by: Praveen Chaudhary pchaudhary@linkedin.com
This commit is contained in:
parent
6d0f8dcb87
commit
87201929d3
@ -3,7 +3,10 @@
|
||||
SONIC_YANG_MGMT_PY = sonic_yang_mgmt-1.0-py2-none-any.whl
|
||||
$(SONIC_YANG_MGMT_PY)_SRC_PATH = $(SRC_PATH)/sonic-yang-mgmt
|
||||
$(SONIC_YANG_MGMT_PY)_PYTHON_VERSION = 2
|
||||
$(SONIC_YANG_MGMT_PY)_DEBS_DEPENDS = $(LIBYANG)
|
||||
$(SONIC_YANG_MGMT_PY)_DEPENDS = $(SONIC_YANG_MODELS_PY3)
|
||||
$(SONIC_YANG_MGMT_PY)_DEBS_DEPENDS = $(LIBYANG) $(LIBYANG_CPP) $(LIBYANG_PY2) \
|
||||
$(LIBYANG_PY3)
|
||||
$(SONIC_YANG_MGMT_PY)_DEPENDS = $(SONIC_YANG_MODELS_PY3)
|
||||
$(SONIC_YANG_MGMT_PY)_RDEPENDS = $(SONIC_YANG_MODELS_PY3) $(LIBYANG) \
|
||||
$(LIBYANG_CPP) $(LIBYANG_PY2)
|
||||
|
||||
SONIC_PYTHON_WHEELS += $(SONIC_YANG_MGMT_PY)
|
||||
|
@ -1,7 +1,8 @@
|
||||
SONIC_YANG_MODELS_PY3 = sonic_yang_models-1.0-py3-none-any.whl
|
||||
$(SONIC_YANG_MODELS_PY3)_SRC_PATH = $(SRC_PATH)/sonic-yang-models
|
||||
$(SONIC_YANG_MODELS_PY3)_PYTHON_VERSION = 3
|
||||
$(SONIC_YANG_MODELS_PY3)_DEBS_DEPENDS = $(LIBYANG)
|
||||
$(SONIC_YANG_MODELS_PY3)_DEBS_DEPENDS = $(LIBYANG) $(LIBYANG_CPP) \
|
||||
$(LIBYANG_PY2) $(LIBYANG_PY3)
|
||||
|
||||
SONIC_PYTHON_WHEELS += $(SONIC_YANG_MODELS_PY3)
|
||||
export SONIC_YANG_MODELS_PY3
|
||||
|
@ -5,25 +5,10 @@
|
||||
|
||||
from setuptools import setup, find_packages
|
||||
from setuptools.command.build_py import build_py
|
||||
from os import system, environ
|
||||
from os import system
|
||||
from sys import exit
|
||||
import pytest
|
||||
|
||||
# find path of pkgs from os environment vars
|
||||
prefix = '../../'; debs = environ["IMAGE_DISTRO_DEBS_PATH"]
|
||||
wheels = environ["PYTHON_WHEELS_PATH"]
|
||||
wheels_path = '{}/{}'.format(prefix, wheels)
|
||||
deps_path = '{}/{}'.format(prefix, debs)
|
||||
# dependencies
|
||||
libyang = '{}/{}'.format(deps_path, environ["LIBYANG"])
|
||||
libyangCpp = '{}/{}'.format(deps_path, environ["LIBYANG_CPP"])
|
||||
libyangPy2 = '{}/{}'.format(deps_path, environ["LIBYANG_PY2"])
|
||||
libyangPy3 = '{}/{}'.format(deps_path, environ["LIBYANG_PY3"])
|
||||
sonicYangModels = '{}/{}'.format(wheels_path, environ["SONIC_YANG_MODELS_PY3"])
|
||||
|
||||
# important reuirements parameters
|
||||
build_requirements = [libyang, libyangCpp, libyangPy2, libyangPy3, sonicYangModels,]
|
||||
|
||||
setup_requirements = ['pytest-runner']
|
||||
|
||||
test_requirements = ['pytest>=3']
|
||||
@ -37,23 +22,6 @@ class pkgBuild(build_py):
|
||||
"""Custom Build PLY"""
|
||||
|
||||
def run (self):
|
||||
# install libyang and sonic_yang_models
|
||||
for req in build_requirements:
|
||||
if '.deb' in req:
|
||||
pkg_install_cmd = "sudo dpkg -i {}".format(req)
|
||||
if (system(pkg_install_cmd)):
|
||||
print("{} installation failed".format(req))
|
||||
exit(1)
|
||||
else:
|
||||
print("{} installed".format(req))
|
||||
elif '.whl' in req:
|
||||
pkg_install_cmd = "pip3 install {}".format(req)
|
||||
if (system(pkg_install_cmd)):
|
||||
print("{} installation failed".format(req))
|
||||
exit(1)
|
||||
else:
|
||||
print("{} installed".format(req))
|
||||
|
||||
# run pytest for libyang python APIs
|
||||
self.pytest_args = []
|
||||
errno = pytest.main(self.pytest_args)
|
||||
|
@ -5,21 +5,9 @@
|
||||
|
||||
from setuptools import setup, find_packages
|
||||
from setuptools.command.build_py import build_py
|
||||
from os import system, environ
|
||||
from os import system
|
||||
from sys import exit
|
||||
|
||||
# find path of pkgs from environment vars
|
||||
prefix = '../../'; debs = environ["IMAGE_DISTRO_DEBS_PATH"]
|
||||
deps_path = '{}/{}'.format(prefix, debs)
|
||||
# dependencies
|
||||
libyang = '{}/{}'.format(deps_path, environ["LIBYANG"])
|
||||
libyangCpp = '{}/{}'.format(deps_path, environ["LIBYANG_CPP"])
|
||||
libyangPy2 = '{}/{}'.format(deps_path, environ["LIBYANG_PY2"])
|
||||
libyangPy3 = '{}/{}'.format(deps_path, environ["LIBYANG_PY3"])
|
||||
|
||||
# important reuirements parameters
|
||||
build_requirements = [libyang, libyangCpp, libyangPy2, libyangPy3,]
|
||||
|
||||
setup_requirements = ['pytest-runner']
|
||||
|
||||
test_requirements = ['pytest>=3']
|
||||
@ -33,16 +21,6 @@ class pkgBuild(build_py):
|
||||
"""Custom Build PLY"""
|
||||
|
||||
def run (self):
|
||||
# install libyang
|
||||
for req in build_requirements:
|
||||
if '.deb'in req:
|
||||
pkg_install_cmd = "sudo dpkg -i {}".format(req)
|
||||
if (system(pkg_install_cmd)):
|
||||
print("{} installation failed".format(req))
|
||||
exit(1)
|
||||
else:
|
||||
print("{} installed".format(req))
|
||||
|
||||
# json file for YANG model test cases.
|
||||
test_yangJson_file = './tests/yang_model_tests/yangTest.json'
|
||||
# YANG models are in below dir
|
||||
@ -53,7 +31,6 @@ class pkgBuild(build_py):
|
||||
test_yang_cmd = "python {} -f {} -y {}".format(yang_test_py, test_yangJson_file, yang_model_dir)
|
||||
if (system(test_yang_cmd)):
|
||||
print("YANG Tests failed\n")
|
||||
# below line will be uncommented after libyang python support PR #
|
||||
exit(1)
|
||||
else:
|
||||
print("YANG Tests passed\n")
|
||||
|
Loading…
Reference in New Issue
Block a user