Change pycommon to use swsscommon (#10099)
#### Why I did it Switch py-common from swsssdk to swsscommon. #### How I did it Change code and make file to use swsscommon. #### How to verify it Pass all UT and E2E test. #### Which release branch to backport (provide reason below if selected) <!-- - Note we only backport fixes to a release branch, *not* features! - Please also provide a reason for the backporting below. - e.g. - [x] 202006 --> - [ ] 201811 - [ ] 201911 - [ ] 202006 - [ ] 202012 - [ ] 202106 - [ ] 202111 #### Description for the changelog <!-- Write a short (one line) summary that describes the changes in this pull request for inclusion in the changelog: --> #### Link to config_db schema for YANG module changes <!-- Provide a link to config_db schema for the table for which YANG model is defined Link should point to correct section on https://github.com/Azure/SONiC/wiki/Configuration. --> #### A picture of a cute animal (not mandatory but encouraged)
This commit is contained in:
parent
4ef8b38edb
commit
e4ed475fcd
@ -4,6 +4,8 @@ ifeq ($(ENABLE_PY2_MODULES), y)
|
|||||||
SONIC_PY_COMMON_PY2 = sonic_py_common-1.0-py2-none-any.whl
|
SONIC_PY_COMMON_PY2 = sonic_py_common-1.0-py2-none-any.whl
|
||||||
$(SONIC_PY_COMMON_PY2)_SRC_PATH = $(SRC_PATH)/sonic-py-common
|
$(SONIC_PY_COMMON_PY2)_SRC_PATH = $(SRC_PATH)/sonic-py-common
|
||||||
$(SONIC_PY_COMMON_PY2)_DEPENDS += $(SWSSSDK_PY2)
|
$(SONIC_PY_COMMON_PY2)_DEPENDS += $(SWSSSDK_PY2)
|
||||||
|
$(SONIC_PY_COMMON_PY2)_DEBS_DEPENDS = $(LIBSWSSCOMMON) \
|
||||||
|
$(PYTHON_SWSSCOMMON)
|
||||||
$(SONIC_PY_COMMON_PY2)_PYTHON_VERSION = 2
|
$(SONIC_PY_COMMON_PY2)_PYTHON_VERSION = 2
|
||||||
SONIC_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY2)
|
SONIC_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY2)
|
||||||
endif
|
endif
|
||||||
@ -13,6 +15,7 @@ endif
|
|||||||
SONIC_PY_COMMON_PY3 = sonic_py_common-1.0-py3-none-any.whl
|
SONIC_PY_COMMON_PY3 = sonic_py_common-1.0-py3-none-any.whl
|
||||||
$(SONIC_PY_COMMON_PY3)_SRC_PATH = $(SRC_PATH)/sonic-py-common
|
$(SONIC_PY_COMMON_PY3)_SRC_PATH = $(SRC_PATH)/sonic-py-common
|
||||||
$(SONIC_PY_COMMON_PY3)_DEPENDS += $(SWSSSDK_PY3)
|
$(SONIC_PY_COMMON_PY3)_DEPENDS += $(SWSSSDK_PY3)
|
||||||
|
$(SONIC_PY_COMMON_PY3)_DEBS_DEPENDS = $(PYTHON3_SWSSCOMMON)
|
||||||
ifeq ($(ENABLE_PY2_MODULES), y)
|
ifeq ($(ENABLE_PY2_MODULES), y)
|
||||||
# Synthetic dependency to avoid building the Python 2 and 3 packages
|
# Synthetic dependency to avoid building the Python 2 and 3 packages
|
||||||
# simultaneously and any potential conflicts which may arise
|
# simultaneously and any potential conflicts which may arise
|
||||||
|
@ -3,11 +3,6 @@ from setuptools import setup
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
'natsort==6.2.1', # 6.2.1 is the last version which supports Python 2
|
'natsort==6.2.1', # 6.2.1 is the last version which supports Python 2
|
||||||
'pyyaml',
|
'pyyaml',
|
||||||
'swsssdk>=2.0.1',
|
|
||||||
]
|
|
||||||
|
|
||||||
high_performance_deps = [
|
|
||||||
'swsssdk[high_perf]>=2.0.1',
|
|
||||||
]
|
]
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
@ -21,9 +16,6 @@ setup(
|
|||||||
maintainer='Joe LeVeque',
|
maintainer='Joe LeVeque',
|
||||||
maintainer_email='jolevequ@microsoft.com',
|
maintainer_email='jolevequ@microsoft.com',
|
||||||
install_requires=dependencies,
|
install_requires=dependencies,
|
||||||
extras_require={
|
|
||||||
'high_perf': high_performance_deps,
|
|
||||||
},
|
|
||||||
packages=[
|
packages=[
|
||||||
'sonic_py_common',
|
'sonic_py_common',
|
||||||
],
|
],
|
||||||
|
@ -7,8 +7,7 @@ import subprocess
|
|||||||
import yaml
|
import yaml
|
||||||
from natsort import natsorted
|
from natsort import natsorted
|
||||||
|
|
||||||
# TODO: Replace with swsscommon
|
from swsscommon.swsscommon import ConfigDBConnector, SonicV2Connector
|
||||||
from swsssdk import ConfigDBConnector, SonicDBConfig, SonicV2Connector
|
|
||||||
|
|
||||||
USR_SHARE_SONIC_PATH = "/usr/share/sonic"
|
USR_SHARE_SONIC_PATH = "/usr/share/sonic"
|
||||||
HOST_DEVICE_PATH = USR_SHARE_SONIC_PATH + "/device"
|
HOST_DEVICE_PATH = USR_SHARE_SONIC_PATH + "/device"
|
||||||
@ -485,7 +484,6 @@ def get_all_namespaces(config_db=None):
|
|||||||
front_ns = []
|
front_ns = []
|
||||||
back_ns = []
|
back_ns = []
|
||||||
num_npus = get_num_npus()
|
num_npus = get_num_npus()
|
||||||
SonicDBConfig.load_sonic_global_db_config()
|
|
||||||
|
|
||||||
if is_multi_npu():
|
if is_multi_npu():
|
||||||
for npu in range(num_npus):
|
for npu in range(num_npus):
|
||||||
|
@ -13,7 +13,7 @@ import pytest
|
|||||||
|
|
||||||
from sonic_py_common import device_info
|
from sonic_py_common import device_info
|
||||||
|
|
||||||
from .mock_swsssdk import SonicV2Connector
|
from .mock_swsscommon import SonicV2Connector
|
||||||
|
|
||||||
# TODO: Remove this if/else block once we no longer support Python 2
|
# TODO: Remove this if/else block once we no longer support Python 2
|
||||||
if sys.version_info.major == 3:
|
if sys.version_info.major == 3:
|
||||||
|
Loading…
Reference in New Issue
Block a user