diff --git a/rules/sonic-yang-mgmt-py2.mk b/rules/sonic-yang-mgmt-py2.mk index f438a6bd5116..0b85d7eb9bdc 100644 --- a/rules/sonic-yang-mgmt-py2.mk +++ b/rules/sonic-yang-mgmt-py2.mk @@ -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) diff --git a/rules/sonic-yang-models-py3.mk b/rules/sonic-yang-models-py3.mk index d2bd01bb9005..8c11a921a979 100644 --- a/rules/sonic-yang-models-py3.mk +++ b/rules/sonic-yang-models-py3.mk @@ -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 diff --git a/src/sonic-yang-mgmt/setup.py b/src/sonic-yang-mgmt/setup.py index ab8fafa1ebfb..63ea0640f899 100644 --- a/src/sonic-yang-mgmt/setup.py +++ b/src/sonic-yang-mgmt/setup.py @@ -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) diff --git a/src/sonic-yang-models/setup.py b/src/sonic-yang-models/setup.py index d614d9bfedfb..6add4c22bffa 100644 --- a/src/sonic-yang-models/setup.py +++ b/src/sonic-yang-models/setup.py @@ -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 @@ def run (self): 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")