Python 2 removal/cleanup

Remove Python 2 package installation from the base image. For container
builds, reference Python 2 packages only if we're not building for
Bullseye.

For libyang, don't build Python 2 bindings at all, since they don't seem
to be used.

Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>
This commit is contained in:
Saikrishna Arcot 2021-07-23 09:21:15 -07:00 committed by Saikrishna Arcot
parent b0b9bb0d68
commit a1d30e3aa0
22 changed files with 139 additions and 258 deletions

View File

@ -102,25 +102,19 @@ sudo mkdir -p $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/ifupdown2_*.deb || \ sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/ifupdown2_*.deb || \
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
# Install ipables (and its dependencies via 'apt-get -y install -f') # Install a patched version of ntp (and its dependencies via 'apt-get -y install -f')
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/iptables_*.deb || \
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
# Install a more recent version of ntp (and its dependencies via 'apt-get -y install -f')
sudo dpkg --root=$FILESYSTEM_ROOT --force-confdef --force-confold -i $debs_path/ntp_*.deb || \ sudo dpkg --root=$FILESYSTEM_ROOT --force-confdef --force-confold -i $debs_path/ntp_*.deb || \
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y \
-o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install -f -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install -f
# Install dependencies for SONiC config engine # Install dependencies for SONiC config engine
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install \ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install \
python-dev \
python3-dev python3-dev
# Install j2cli for handling jinja template # Install j2cli for handling jinja template
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install "j2cli==0.3.10" sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install "j2cli==0.3.10"
# Install Python client for Redis # Install Python client for Redis
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip2 install "redis==3.5.3"
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install "redis==3.5.3" sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install "redis==3.5.3"
# Install redis-dump-load Python 3 package # Install redis-dump-load Python 3 package
@ -130,17 +124,10 @@ sudo cp {{redis_dump_load_py3_wheel_path}} $FILESYSTEM_ROOT/$REDIS_DUMP_LOAD_PY3
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install $REDIS_DUMP_LOAD_PY3_WHEEL_NAME sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install $REDIS_DUMP_LOAD_PY3_WHEEL_NAME
sudo rm -rf $FILESYSTEM_ROOT/$REDIS_DUMP_LOAD_PY3_WHEEL_NAME sudo rm -rf $FILESYSTEM_ROOT/$REDIS_DUMP_LOAD_PY3_WHEEL_NAME
# Install redis-dump-load Python 2 package
REDIS_DUMP_LOAD_PY2_WHEEL_NAME=$(basename {{redis_dump_load_py2_wheel_path}})
sudo cp {{redis_dump_load_py2_wheel_path}} $FILESYSTEM_ROOT/$REDIS_DUMP_LOAD_PY2_WHEEL_NAME
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip2 install $REDIS_DUMP_LOAD_PY2_WHEEL_NAME
sudo rm -rf $FILESYSTEM_ROOT/$REDIS_DUMP_LOAD_PY2_WHEEL_NAME
# Install Python module for psutil # Install Python module for psutil
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install psutil sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install psutil
# Install Python module for ipaddr # Install Python module for ipaddr
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip2 install ipaddr
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install ipaddr sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install ipaddr
# Install Python module for grpcio and grpcio-toole # Install Python module for grpcio and grpcio-toole
@ -154,18 +141,6 @@ sudo cp {{swsssdk_py3_wheel_path}} $FILESYSTEM_ROOT/$SWSSSDK_PY3_WHEEL_NAME
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install $SWSSSDK_PY3_WHEEL_NAME sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install $SWSSSDK_PY3_WHEEL_NAME
sudo rm -rf $FILESYSTEM_ROOT/$SWSSSDK_PY3_WHEEL_NAME sudo rm -rf $FILESYSTEM_ROOT/$SWSSSDK_PY3_WHEEL_NAME
# Install SwSS SDK Python 2 package
SWSSSDK_PY2_WHEEL_NAME=$(basename {{swsssdk_py2_wheel_path}})
sudo cp {{swsssdk_py2_wheel_path}} $FILESYSTEM_ROOT/$SWSSSDK_PY2_WHEEL_NAME
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip2 install $SWSSSDK_PY2_WHEEL_NAME
sudo rm -rf $FILESYSTEM_ROOT/$SWSSSDK_PY2_WHEEL_NAME
# Install sonic-py-common Python 2 package
SONIC_PY_COMMON_PY2_WHEEL_NAME=$(basename {{sonic_py_common_py2_wheel_path}})
sudo cp {{sonic_py_common_py2_wheel_path}} $FILESYSTEM_ROOT/$SONIC_PY_COMMON_PY2_WHEEL_NAME
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip2 install $SONIC_PY_COMMON_PY2_WHEEL_NAME
sudo rm -rf $FILESYSTEM_ROOT/$SONIC_PY_COMMON_PY2_WHEEL_NAME
# Install sonic-py-common Python 3 package # Install sonic-py-common Python 3 package
SONIC_PY_COMMON_PY3_WHEEL_NAME=$(basename {{sonic_py_common_py3_wheel_path}}) SONIC_PY_COMMON_PY3_WHEEL_NAME=$(basename {{sonic_py_common_py3_wheel_path}})
sudo cp {{sonic_py_common_py3_wheel_path}} $FILESYSTEM_ROOT/$SONIC_PY_COMMON_PY3_WHEEL_NAME sudo cp {{sonic_py_common_py3_wheel_path}} $FILESYSTEM_ROOT/$SONIC_PY_COMMON_PY3_WHEEL_NAME
@ -180,7 +155,6 @@ fi
# Install sonic-yang-models Python 3 package, install dependencies # Install sonic-yang-models Python 3 package, install dependencies
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/libyang_*.deb sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/libyang_*.deb
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/libyang-cpp_*.deb sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/libyang-cpp_*.deb
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/python2-yang_*.deb
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/python3-yang_*.deb sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/python3-yang_*.deb
SONIC_YANG_MODEL_PY3_WHEEL_NAME=$(basename {{sonic_yang_models_py3_wheel_path}}) SONIC_YANG_MODEL_PY3_WHEEL_NAME=$(basename {{sonic_yang_models_py3_wheel_path}})
sudo cp {{sonic_yang_models_py3_wheel_path}} $FILESYSTEM_ROOT/$SONIC_YANG_MODEL_PY3_WHEEL_NAME sudo cp {{sonic_yang_models_py3_wheel_path}} $FILESYSTEM_ROOT/$SONIC_YANG_MODEL_PY3_WHEEL_NAME
@ -193,12 +167,6 @@ sudo cp {{sonic_yang_mgmt_py3_wheel_path}} $FILESYSTEM_ROOT/$SONIC_YANG_MGMT_PY3
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install $SONIC_YANG_MGMT_PY3_WHEEL_NAME sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install $SONIC_YANG_MGMT_PY3_WHEEL_NAME
sudo rm -rf $FILESYSTEM_ROOT/$SONIC_YANG_MGMT_PY3_WHEEL_NAME sudo rm -rf $FILESYSTEM_ROOT/$SONIC_YANG_MGMT_PY3_WHEEL_NAME
# Install SONiC config engine Python 2 package
CONFIG_ENGINE_PY2_WHEEL_NAME=$(basename {{config_engine_py2_wheel_path}})
sudo cp {{config_engine_py2_wheel_path}} $FILESYSTEM_ROOT/$CONFIG_ENGINE_PY2_WHEEL_NAME
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip2 install $CONFIG_ENGINE_PY2_WHEEL_NAME
sudo rm -rf $FILESYSTEM_ROOT/$CONFIG_ENGINE_PY2_WHEEL_NAME
# For sonic-config-engine Python 3 package # For sonic-config-engine Python 3 package
# Install pyangbind here, outside sonic-config-engine dependencies, as pyangbind causes enum34 to be installed. # Install pyangbind here, outside sonic-config-engine dependencies, as pyangbind causes enum34 to be installed.
# Then immediately uninstall enum34, as enum34 should not be installed for Python >= 3.4, as it causes a # Then immediately uninstall enum34, as enum34 should not be installed for Python >= 3.4, as it causes a
@ -214,12 +182,6 @@ sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install $CONFI
sudo rm -rf $FILESYSTEM_ROOT/$CONFIG_ENGINE_PY3_WHEEL_NAME sudo rm -rf $FILESYSTEM_ROOT/$CONFIG_ENGINE_PY3_WHEEL_NAME
# Install sonic-platform-common Python 2 package
PLATFORM_COMMON_PY2_WHEEL_NAME=$(basename {{platform_common_py2_wheel_path}})
sudo cp {{platform_common_py2_wheel_path}} $FILESYSTEM_ROOT/$PLATFORM_COMMON_PY2_WHEEL_NAME
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip2 install $PLATFORM_COMMON_PY2_WHEEL_NAME
sudo rm -rf $FILESYSTEM_ROOT/$PLATFORM_COMMON_PY2_WHEEL_NAME
# Install sonic-platform-common Python 3 package # Install sonic-platform-common Python 3 package
PLATFORM_COMMON_PY3_WHEEL_NAME=$(basename {{platform_common_py3_wheel_path}}) PLATFORM_COMMON_PY3_WHEEL_NAME=$(basename {{platform_common_py3_wheel_path}})
sudo cp {{platform_common_py3_wheel_path}} $FILESYSTEM_ROOT/$PLATFORM_COMMON_PY3_WHEEL_NAME sudo cp {{platform_common_py3_wheel_path}} $FILESYSTEM_ROOT/$PLATFORM_COMMON_PY3_WHEEL_NAME
@ -227,12 +189,6 @@ sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install $PLATF
sudo rm -rf $FILESYSTEM_ROOT/$PLATFORM_COMMON_PY3_WHEEL_NAME sudo rm -rf $FILESYSTEM_ROOT/$PLATFORM_COMMON_PY3_WHEEL_NAME
{% if pddf_support == "y" %} {% if pddf_support == "y" %}
# Install pddf-platform-api-base Python 2 package
PLATFORM_PDDF_COMMON_PY2_WHEEL_NAME=$(basename {{pddf_platform_api_base_py2_wheel_path}})
sudo cp {{pddf_platform_api_base_py2_wheel_path}} $FILESYSTEM_ROOT/$PLATFORM_PDDF_COMMON_PY2_WHEEL_NAME
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip2 install $PLATFORM_PDDF_COMMON_PY2_WHEEL_NAME
sudo rm -rf $FILESYSTEM_ROOT/$PLATFORM_PDDF_COMMON_PY2_WHEEL_NAME
# Install pddf-platform-api-base Python 3 package # Install pddf-platform-api-base Python 3 package
PLATFORM_PDDF_COMMON_PY3_WHEEL_NAME=$(basename {{pddf_platform_api_base_py3_wheel_path}}) PLATFORM_PDDF_COMMON_PY3_WHEEL_NAME=$(basename {{pddf_platform_api_base_py3_wheel_path}})
sudo cp {{pddf_platform_api_base_py3_wheel_path}} $FILESYSTEM_ROOT/$PLATFORM_PDDF_COMMON_PY3_WHEEL_NAME sudo cp {{pddf_platform_api_base_py3_wheel_path}} $FILESYSTEM_ROOT/$PLATFORM_PDDF_COMMON_PY3_WHEEL_NAME
@ -242,7 +198,6 @@ sudo rm -rf $FILESYSTEM_ROOT/$PLATFORM_PDDF_COMMON_PY3_WHEEL_NAME
{# Barefoot platform vendors' sonic_platform packages import the Python 'thrift' library #} {# Barefoot platform vendors' sonic_platform packages import the Python 'thrift' library #}
{% if sonic_asic_platform == "barefoot" %} {% if sonic_asic_platform == "barefoot" %}
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip2 install thrift==0.13.0
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install thrift==0.13.0 sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install thrift==0.13.0
{% endif %} {% endif %}
@ -876,12 +831,6 @@ sudo cp $files_path/$MLNX_SSD_FW_UPDATE $FILESYSTEM_ROOT/usr/bin/$MLNX_SSD_FW_UP
j2 platform/mellanox/mlnx-fw-upgrade.j2 | sudo tee $FILESYSTEM_ROOT/usr/bin/mlnx-fw-upgrade.sh j2 platform/mellanox/mlnx-fw-upgrade.j2 | sudo tee $FILESYSTEM_ROOT/usr/bin/mlnx-fw-upgrade.sh
sudo chmod 755 $FILESYSTEM_ROOT/usr/bin/mlnx-fw-upgrade.sh sudo chmod 755 $FILESYSTEM_ROOT/usr/bin/mlnx-fw-upgrade.sh
# Install mlnx-sonic-platform Python 2 package
MLNX_SONIC_PLATFORM_PY2_WHEEL_NAME=$(basename {{mlnx_platform_api_py2_wheel_path}})
sudo cp {{mlnx_platform_api_py2_wheel_path}} $FILESYSTEM_ROOT/$MLNX_SONIC_PLATFORM_PY2_WHEEL_NAME
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip2 install $MLNX_SONIC_PLATFORM_PY2_WHEEL_NAME
sudo rm -rf $FILESYSTEM_ROOT/$MLNX_SONIC_PLATFORM_PY2_WHEEL_NAME
# Install mlnx-sonic-platform Python 3 package # Install mlnx-sonic-platform Python 3 package
MLNX_SONIC_PLATFORM_PY3_WHEEL_NAME=$(basename {{mlnx_platform_api_py3_wheel_path}}) MLNX_SONIC_PLATFORM_PY3_WHEEL_NAME=$(basename {{mlnx_platform_api_py3_wheel_path}})
sudo cp {{mlnx_platform_api_py3_wheel_path}} $FILESYSTEM_ROOT/$MLNX_SONIC_PLATFORM_PY3_WHEEL_NAME sudo cp {{mlnx_platform_api_py3_wheel_path}} $FILESYSTEM_ROOT/$MLNX_SONIC_PLATFORM_PY3_WHEEL_NAME

View File

@ -5,22 +5,26 @@ PDDF_PLATFORM_API_BASE_VERSION = 1.0
export PDDF_PLATFORM_API_BASE_VERSION export PDDF_PLATFORM_API_BASE_VERSION
PDDF_PLATFORM_API_BASE_PY2 = sonic_platform_pddf_common-$(PDDF_PLATFORM_API_BASE_VERSION)-py2-none-any.whl ifeq ($(ENABLE_PY2_MODULES), y)
$(PDDF_PLATFORM_API_BASE_PY2)_SRC_PATH = $(PLATFORM_PDDF_PATH)/platform-api-pddf-base PDDF_PLATFORM_API_BASE_PY2 = sonic_platform_pddf_common-$(PDDF_PLATFORM_API_BASE_VERSION)-py2-none-any.whl
$(PDDF_PLATFORM_API_BASE_PY2)_PYTHON_VERSION = 2 $(PDDF_PLATFORM_API_BASE_PY2)_SRC_PATH = $(PLATFORM_PDDF_PATH)/platform-api-pddf-base
$(PDDF_PLATFORM_API_BASE_PY2)_DEPENDS = $(SONIC_CONFIG_ENGINE) $(PDDF_PLATFORM_API_BASE_PY2)_PYTHON_VERSION = 2
SONIC_PYTHON_WHEELS += $(PDDF_PLATFORM_API_BASE_PY2) $(PDDF_PLATFORM_API_BASE_PY2)_DEPENDS = $(SONIC_CONFIG_ENGINE)
SONIC_PYTHON_WHEELS += $(PDDF_PLATFORM_API_BASE_PY2)
export pddf_platform_api_base_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(PDDF_PLATFORM_API_BASE_PY2))" export pddf_platform_api_base_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(PDDF_PLATFORM_API_BASE_PY2))"
export PDDF_PLATFORM_API_BASE_PY2 export PDDF_PLATFORM_API_BASE_PY2
endif
PDDF_PLATFORM_API_BASE_PY3 = sonic_platform_pddf_common-$(PDDF_PLATFORM_API_BASE_VERSION)-py3-none-any.whl PDDF_PLATFORM_API_BASE_PY3 = sonic_platform_pddf_common-$(PDDF_PLATFORM_API_BASE_VERSION)-py3-none-any.whl
$(PDDF_PLATFORM_API_BASE_PY3)_SRC_PATH = $(PLATFORM_PDDF_PATH)/platform-api-pddf-base $(PDDF_PLATFORM_API_BASE_PY3)_SRC_PATH = $(PLATFORM_PDDF_PATH)/platform-api-pddf-base
$(PDDF_PLATFORM_API_BASE_PY3)_PYTHON_VERSION = 3 $(PDDF_PLATFORM_API_BASE_PY3)_PYTHON_VERSION = 3
$(PDDF_PLATFORM_API_BASE_PY3)_DEPENDS = $(SONIC_CONFIG_ENGINE) $(PDDF_PLATFORM_API_BASE_PY3)_DEPENDS = $(SONIC_CONFIG_ENGINE)
# Synthetic dependency to avoid building the Python 2 and 3 packages ifeq ($(ENABLE_PY2_MODULES), y)
# simultaneously and any potential conflicts which may arise # Synthetic dependency to avoid building the Python 2 and 3 packages
$(PDDF_PLATFORM_API_BASE_PY3)_DEPENDS += $(PDDF_PLATFORM_API_BASE_PY2) # simultaneously and any potential conflicts which may arise
$(PDDF_PLATFORM_API_BASE_PY3)_DEPENDS += $(PDDF_PLATFORM_API_BASE_PY2)
endif
$(PDDF_PLATFORM_API_BASE_PY3)_TEST = n $(PDDF_PLATFORM_API_BASE_PY3)_TEST = n
SONIC_PYTHON_WHEELS += $(PDDF_PLATFORM_API_BASE_PY3) SONIC_PYTHON_WHEELS += $(PDDF_PLATFORM_API_BASE_PY3)

View File

@ -11,7 +11,6 @@ $(DOCKER_SONIC_VS)_DEPENDS += $(SWSS) \
$(SONIC_DEVICE_DATA) \ $(SONIC_DEVICE_DATA) \
$(LIBYANG) \ $(LIBYANG) \
$(LIBYANG_CPP) \ $(LIBYANG_CPP) \
$(LIBYANG_PY2) \
$(LIBYANG_PY3) \ $(LIBYANG_PY3) \
$(SONIC_UTILITIES_DATA) \ $(SONIC_UTILITIES_DATA) \
$(SONIC_HOST_SERVICES_DATA) $(SONIC_HOST_SERVICES_DATA)

View File

@ -29,11 +29,7 @@ LIBYANG_PY3 = python3-yang_$(LIBYANG_VERSION)_$(CONFIGURED_ARCH).deb
$(LIBYANG_PY3)_DEPENDS += $(LIBYANG) $(LIBYANG_CPP) $(LIBYANG_PY3)_DEPENDS += $(LIBYANG) $(LIBYANG_CPP)
$(eval $(call add_derived_package,$(LIBYANG),$(LIBYANG_PY3))) $(eval $(call add_derived_package,$(LIBYANG),$(LIBYANG_PY3)))
LIBYANG_PY2 = python2-yang_$(LIBYANG_VERSION)_$(CONFIGURED_ARCH).deb
$(LIBYANG_PY2)_DEPENDS += $(LIBYANG) $(LIBYANG_CPP)
$(eval $(call add_derived_package,$(LIBYANG),$(LIBYANG_PY2)))
$(eval $(call add_conflict_package,$(LIBYANG),$(LIBYANG1))) $(eval $(call add_conflict_package,$(LIBYANG),$(LIBYANG1)))
$(eval $(call add_conflict_package,$(LIBYANG_DEV),$(LIBYANG1_DEV))) $(eval $(call add_conflict_package,$(LIBYANG_DEV),$(LIBYANG1_DEV)))
export LIBYANG LIBYANG_DBG LIBYANG_DEV LIBYANG_CPP LIBYANG_PY3 LIBYANG_PY2 export LIBYANG LIBYANG_DBG LIBYANG_DEV LIBYANG_CPP LIBYANG_PY3

View File

@ -1,12 +1,12 @@
ifeq ($(ENABLE_PY2_MODULES), y)
SPATH := $($(REDIS_DUMP_LOAD_PY2)_SRC_PATH)
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/redis-dump-load-py2.mk rules/redis-dump-load-py2.dep
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files))
SPATH := $($(REDIS_DUMP_LOAD_PY2)_SRC_PATH) $(REDIS_DUMP_LOAD_PY2)_CACHE_MODE := GIT_CONTENT_SHA
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/redis-dump-load-py2.mk rules/redis-dump-load-py2.dep $(REDIS_DUMP_LOAD_PY2)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) $(REDIS_DUMP_LOAD_PY2)_DEP_FILES := $(DEP_FILES)
SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files)) $(REDIS_DUMP_LOAD_PY2)_SMDEP_FILES := $(SMDEP_FILES)
$(REDIS_DUMP_LOAD_PY2)_SMDEP_PATHS := $(SPATH)
$(REDIS_DUMP_LOAD_PY2)_CACHE_MODE := GIT_CONTENT_SHA endif
$(REDIS_DUMP_LOAD_PY2)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
$(REDIS_DUMP_LOAD_PY2)_DEP_FILES := $(DEP_FILES)
$(REDIS_DUMP_LOAD_PY2)_SMDEP_FILES := $(SMDEP_FILES)
$(REDIS_DUMP_LOAD_PY2)_SMDEP_PATHS := $(SPATH)

View File

@ -1,6 +1,8 @@
# redis_dump_load python2 wheel ifeq ($(ENABLE_PY2_MODULES), y)
# redis_dump_load python2 wheel
REDIS_DUMP_LOAD_PY2 = redis_dump_load-1.1-py2-none-any.whl REDIS_DUMP_LOAD_PY2 = redis_dump_load-1.1-py2-none-any.whl
$(REDIS_DUMP_LOAD_PY2)_SRC_PATH = $(SRC_PATH)/redis-dump-load $(REDIS_DUMP_LOAD_PY2)_SRC_PATH = $(SRC_PATH)/redis-dump-load
$(REDIS_DUMP_LOAD_PY2)_PYTHON_VERSION = 2 $(REDIS_DUMP_LOAD_PY2)_PYTHON_VERSION = 2
SONIC_PYTHON_WHEELS += $(REDIS_DUMP_LOAD_PY2) SONIC_PYTHON_WHEELS += $(REDIS_DUMP_LOAD_PY2)
endif

View File

@ -3,7 +3,9 @@
REDIS_DUMP_LOAD_PY3 = redis_dump_load-1.1-py3-none-any.whl REDIS_DUMP_LOAD_PY3 = redis_dump_load-1.1-py3-none-any.whl
$(REDIS_DUMP_LOAD_PY3)_SRC_PATH = $(SRC_PATH)/redis-dump-load $(REDIS_DUMP_LOAD_PY3)_SRC_PATH = $(SRC_PATH)/redis-dump-load
$(REDIS_DUMP_LOAD_PY3)_PYTHON_VERSION = 3 $(REDIS_DUMP_LOAD_PY3)_PYTHON_VERSION = 3
# Synthetic dependency just to avoid race condition ifeq ($(ENABLE_PY2_MODULES), y)
$(REDIS_DUMP_LOAD_PY3)_DEPENDS += $(REDIS_DUMP_LOAD_PY2) # Synthetic dependency just to avoid race condition
$(REDIS_DUMP_LOAD_PY3)_DEPENDS += $(REDIS_DUMP_LOAD_PY2)
endif
$(REDIS_DUMP_LOAD_PY3)_TEST = n $(REDIS_DUMP_LOAD_PY3)_TEST = n
SONIC_PYTHON_WHEELS += $(REDIS_DUMP_LOAD_PY3) SONIC_PYTHON_WHEELS += $(REDIS_DUMP_LOAD_PY3)

View File

@ -1,14 +1,16 @@
# SONIC_CONFIG_ENGINE_PY2 package # SONIC_CONFIG_ENGINE_PY2 package
SPATH := $($(SONIC_CONFIG_ENGINE_PY2)_SRC_PATH) SPATH := $($(SONIC_CONFIG_ENGINE_PY3)_SRC_PATH)
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/sonic-config.mk rules/sonic-config.dep DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/sonic-config.mk rules/sonic-config.dep
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
DEP_FILES += $(shell git ls-files $(SPATH)) DEP_FILES += $(shell git ls-files $(SPATH))
DEP_FILES += files/image_config/interfaces/interfaces.j2 dockers/docker-orchagent/ports.json.j2 dockers/docker-dhcp-relay/wait_for_intf.sh.j2 dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 dockers/docker-lldp/lldpd.conf.j2 dockers/docker-orchagent/ipinip.json.j2 $(wildcard device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/*.j2 device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/*.j2) files/build_templates/qos_config.j2 dockers/docker-orchagent/switch.json.j2 files/image_config/constants/constants.yml DEP_FILES += files/image_config/interfaces/interfaces.j2 dockers/docker-orchagent/ports.json.j2 dockers/docker-dhcp-relay/wait_for_intf.sh.j2 dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 dockers/docker-lldp/lldpd.conf.j2 dockers/docker-orchagent/ipinip.json.j2 $(wildcard device/arista/x86_64-arista_7050_qx32s/Arista-7050-QX-32S/*.j2 device/dell/x86_64-dell_s6100_c2538-r0/Force10-S6100/*.j2) files/build_templates/qos_config.j2 dockers/docker-orchagent/switch.json.j2 files/image_config/constants/constants.yml
$(SONIC_CONFIG_ENGINE_PY2)_CACHE_MODE := GIT_CONTENT_SHA ifeq ($(ENABLE_PY2_MODULES), y)
$(SONIC_CONFIG_ENGINE_PY2)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) $(SONIC_CONFIG_ENGINE_PY2)_CACHE_MODE := GIT_CONTENT_SHA
$(SONIC_CONFIG_ENGINE_PY2)_DEP_FILES := $(DEP_FILES) $(SONIC_CONFIG_ENGINE_PY2)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
$(SONIC_CONFIG_ENGINE_PY2)_DEP_FILES := $(DEP_FILES)
endif
# SONIC_CONFIG_ENGINE_PY3 package # SONIC_CONFIG_ENGINE_PY3 package

View File

@ -1,11 +1,13 @@
# SONIC_CONFIG_ENGINE_PY2 package ifeq ($(ENABLE_PY2_MODULES), y)
# SONIC_CONFIG_ENGINE_PY2 package
SONIC_CONFIG_ENGINE_PY2 = sonic_config_engine-1.0-py2-none-any.whl SONIC_CONFIG_ENGINE_PY2 = sonic_config_engine-1.0-py2-none-any.whl
$(SONIC_CONFIG_ENGINE_PY2)_SRC_PATH = $(SRC_PATH)/sonic-config-engine $(SONIC_CONFIG_ENGINE_PY2)_SRC_PATH = $(SRC_PATH)/sonic-config-engine
$(SONIC_CONFIG_ENGINE_PY2)_DEPENDS += $(SONIC_PY_COMMON_PY2) $(SONIC_CONFIG_ENGINE_PY2)_DEPENDS += $(SONIC_PY_COMMON_PY2)
$(SONIC_CONFIG_ENGINE_PY2)_DEBS_DEPENDS += $(PYTHON_SWSSCOMMON) $(SONIC_CONFIG_ENGINE_PY2)_DEBS_DEPENDS += $(PYTHON_SWSSCOMMON)
$(SONIC_CONFIG_ENGINE_PY2)_PYTHON_VERSION = 2 $(SONIC_CONFIG_ENGINE_PY2)_PYTHON_VERSION = 2
SONIC_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY2) SONIC_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY2)
endif
# SONIC_CONFIG_ENGINE_PY3 package # SONIC_CONFIG_ENGINE_PY3 package
@ -18,8 +20,10 @@ $(SONIC_CONFIG_ENGINE_PY3)_DEBS_DEPENDS += $(LIBYANG) \
$(LIBYANG_CPP) \ $(LIBYANG_CPP) \
$(LIBYANG_PY3) \ $(LIBYANG_PY3) \
$(PYTHON3_SWSSCOMMON) $(PYTHON3_SWSSCOMMON)
# Synthetic dependency to avoid building the Python 2 and 3 packages ifeq ($(ENABLE_PY2_MODULES), y)
# simultaneously and any potential conflicts which may arise # Synthetic dependency to avoid building the Python 2 and 3 packages
$(SONIC_CONFIG_ENGINE_PY3)_DEPENDS += $(SONIC_CONFIG_ENGINE_PY2) # simultaneously and any potential conflicts which may arise
$(SONIC_CONFIG_ENGINE_PY3)_DEPENDS += $(SONIC_CONFIG_ENGINE_PY2)
endif
$(SONIC_CONFIG_ENGINE_PY3)_PYTHON_VERSION = 3 $(SONIC_CONFIG_ENGINE_PY3)_PYTHON_VERSION = 3
SONIC_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY3) SONIC_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY3)

View File

@ -1,15 +1,16 @@
SPATH := $($(SONIC_PLATFORM_COMMON_PY2)_SRC_PATH) SPATH := $($(SONIC_PLATFORM_COMMON_PY3)_SRC_PATH)
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/sonic-platform-common.mk rules/sonic-platform-common.dep DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/sonic-platform-common.mk rules/sonic-platform-common.dep
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files|grep -Ev "^sonic_sfp|^sonic_eeprom")) SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files|grep -Ev "^sonic_sfp|^sonic_eeprom"))
$(SONIC_PLATFORM_COMMON_PY2)_CACHE_MODE := GIT_CONTENT_SHA ifeq ($(ENABLE_PY2_MODULES), y)
$(SONIC_PLATFORM_COMMON_PY2)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) $(SONIC_PLATFORM_COMMON_PY2)_CACHE_MODE := GIT_CONTENT_SHA
$(SONIC_PLATFORM_COMMON_PY2)_DEP_FILES := $(DEP_FILES) $(SONIC_PLATFORM_COMMON_PY2)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
$(SONIC_PLATFORM_COMMON_PY2)_SMDEP_FILES := $(SMDEP_FILES) $(SONIC_PLATFORM_COMMON_PY2)_DEP_FILES := $(DEP_FILES)
$(SONIC_PLATFORM_COMMON_PY2)_SMDEP_PATHS := $(SPATH) $(SONIC_PLATFORM_COMMON_PY2)_SMDEP_FILES := $(SMDEP_FILES)
$(SONIC_PLATFORM_COMMON_PY2)_SMDEP_PATHS := $(SPATH)
endif
$(SONIC_PLATFORM_COMMON_PY3)_CACHE_MODE := GIT_CONTENT_SHA $(SONIC_PLATFORM_COMMON_PY3)_CACHE_MODE := GIT_CONTENT_SHA

View File

@ -1,11 +1,13 @@
# sonic-platform-common package ifeq ($(ENABLE_PY2_MODULES), y)
# sonic-platform-common package
SONIC_PLATFORM_COMMON_PY2 = sonic_platform_common-1.0-py2-none-any.whl SONIC_PLATFORM_COMMON_PY2 = sonic_platform_common-1.0-py2-none-any.whl
$(SONIC_PLATFORM_COMMON_PY2)_SRC_PATH = $(SRC_PATH)/sonic-platform-common $(SONIC_PLATFORM_COMMON_PY2)_SRC_PATH = $(SRC_PATH)/sonic-platform-common
$(SONIC_PLATFORM_COMMON_PY2)_PYTHON_VERSION = 2 $(SONIC_PLATFORM_COMMON_PY2)_PYTHON_VERSION = 2
$(SONIC_PLATFORM_COMMON_PY2)_DEPENDS += $(SONIC_PY_COMMON_PY2) $(SONIC_CONFIG_ENGINE_PY2) $(SONIC_PLATFORM_COMMON_PY2)_DEPENDS += $(SONIC_PY_COMMON_PY2) $(SONIC_CONFIG_ENGINE_PY2)
$(SONIC_PLATFORM_COMMON_PY2)_DEBS_DEPENDS += $(PYTHON_SWSSCOMMON) $(SONIC_PLATFORM_COMMON_PY2)_DEBS_DEPENDS += $(PYTHON_SWSSCOMMON)
SONIC_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY2) SONIC_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY2)
endif
# Als build sonic-platform-common into python3 wheel, so we can use PSU code in SNMP docker # Als build sonic-platform-common into python3 wheel, so we can use PSU code in SNMP docker
SONIC_PLATFORM_COMMON_PY3 = sonic_platform_common-1.0-py3-none-any.whl SONIC_PLATFORM_COMMON_PY3 = sonic_platform_common-1.0-py3-none-any.whl
@ -13,6 +15,8 @@ $(SONIC_PLATFORM_COMMON_PY3)_SRC_PATH = $(SRC_PATH)/sonic-platform-common
$(SONIC_PLATFORM_COMMON_PY3)_PYTHON_VERSION = 3 $(SONIC_PLATFORM_COMMON_PY3)_PYTHON_VERSION = 3
$(SONIC_PLATFORM_COMMON_PY3)_DEPENDS += $(SONIC_PY_COMMON_PY3) $(SONIC_CONFIG_ENGINE_PY3) $(SONIC_PLATFORM_COMMON_PY3)_DEPENDS += $(SONIC_PY_COMMON_PY3) $(SONIC_CONFIG_ENGINE_PY3)
$(SONIC_PLATFORM_COMMON_PY3)_DEBS_DEPENDS += $(PYTHON3_SWSSCOMMON) $(SONIC_PLATFORM_COMMON_PY3)_DEBS_DEPENDS += $(PYTHON3_SWSSCOMMON)
# Synthetic dependency just to avoid race condition ifeq ($(ENABLE_PY2_MODULES), y)
$(SONIC_PLATFORM_COMMON_PY3)_DEPENDS += $(SONIC_PLATFORM_COMMON_PY2) # Synthetic dependency just to avoid race condition
$(SONIC_PLATFORM_COMMON_PY3)_DEPENDS += $(SONIC_PLATFORM_COMMON_PY2)
endif
SONIC_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY3) SONIC_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY3)

View File

@ -1,11 +1,13 @@
SPATH := $($(SONIC_PY_COMMON_PY2)_SRC_PATH) SPATH := $($(SONIC_PY_COMMON_PY3)_SRC_PATH)
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/sonic-py-common.mk rules/sonic-py-common.dep DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/sonic-py-common.mk rules/sonic-py-common.dep
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
DEP_FILES += $(shell git ls-files $(SPATH)) DEP_FILES += $(shell git ls-files $(SPATH))
$(SONIC_PY_COMMON_PY2)_CACHE_MODE := GIT_CONTENT_SHA ifeq ($(ENABLE_PY2_MODULES), y)
$(SONIC_PY_COMMON_PY2)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) $(SONIC_PY_COMMON_PY2)_CACHE_MODE := GIT_CONTENT_SHA
$(SONIC_PY_COMMON_PY2)_DEP_FILES := $(DEP_FILES) $(SONIC_PY_COMMON_PY2)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
$(SONIC_PY_COMMON_PY2)_DEP_FILES := $(DEP_FILES)
endif
$(SONIC_PY_COMMON_PY3)_CACHE_MODE := GIT_CONTENT_SHA $(SONIC_PY_COMMON_PY3)_CACHE_MODE := GIT_CONTENT_SHA
$(SONIC_PY_COMMON_PY3)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) $(SONIC_PY_COMMON_PY3)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)

View File

@ -1,18 +1,22 @@
# SONIC_PY_COMMON_PY2 package ifeq ($(ENABLE_PY2_MODULES), y)
# SONIC_PY_COMMON_PY2 package
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)_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
# SONIC_PY_COMMON_PY3 package # SONIC_PY_COMMON_PY3 package
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)
# Synthetic dependency to avoid building the Python 2 and 3 packages ifeq ($(ENABLE_PY2_MODULES), y)
# simultaneously and any potential conflicts which may arise # Synthetic dependency to avoid building the Python 2 and 3 packages
$(SONIC_PY_COMMON_PY3)_DEPENDS += $(SONIC_PY_COMMON_PY2) # simultaneously and any potential conflicts which may arise
$(SONIC_PY_COMMON_PY3)_DEPENDS += $(SONIC_PY_COMMON_PY2)
endif
$(SONIC_PY_COMMON_PY3)_PYTHON_VERSION = 3 $(SONIC_PY_COMMON_PY3)_PYTHON_VERSION = 3
SONIC_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY3) SONIC_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY3)

View File

@ -2,7 +2,7 @@ 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)_SRC_PATH = $(SRC_PATH)/sonic-yang-models
$(SONIC_YANG_MODELS_PY3)_PYTHON_VERSION = 3 $(SONIC_YANG_MODELS_PY3)_PYTHON_VERSION = 3
$(SONIC_YANG_MODELS_PY3)_DEBS_DEPENDS = $(LIBYANG) $(LIBYANG_CPP) \ $(SONIC_YANG_MODELS_PY3)_DEBS_DEPENDS = $(LIBYANG) $(LIBYANG_CPP) \
$(LIBYANG_PY2) $(LIBYANG_PY3) $(LIBYANG_PY3)
SONIC_PYTHON_WHEELS += $(SONIC_YANG_MODELS_PY3) SONIC_PYTHON_WHEELS += $(SONIC_YANG_MODELS_PY3)
export SONIC_YANG_MODELS_PY3 export SONIC_YANG_MODELS_PY3

View File

@ -17,8 +17,10 @@ SONIC_DPKG_DEBS += $(LIBSWSSCOMMON)
LIBSWSSCOMMON_DEV = $(LIBSWSSCOMMON_NAME)-dev_$(LIBSWSSCOMMON_VERSION)_$(CONFIGURED_ARCH).deb LIBSWSSCOMMON_DEV = $(LIBSWSSCOMMON_NAME)-dev_$(LIBSWSSCOMMON_VERSION)_$(CONFIGURED_ARCH).deb
$(eval $(call add_derived_package,$(LIBSWSSCOMMON),$(LIBSWSSCOMMON_DEV))) $(eval $(call add_derived_package,$(LIBSWSSCOMMON),$(LIBSWSSCOMMON_DEV)))
PYTHON_SWSSCOMMON = python-swsscommon_$(LIBSWSSCOMMON_VERSION)_$(CONFIGURED_ARCH).deb ifeq ($(ENABLE_PY2_MODULES), y)
$(eval $(call add_derived_package,$(LIBSWSSCOMMON),$(PYTHON_SWSSCOMMON))) PYTHON_SWSSCOMMON = python-swsscommon_$(LIBSWSSCOMMON_VERSION)_$(CONFIGURED_ARCH).deb
$(eval $(call add_derived_package,$(LIBSWSSCOMMON),$(PYTHON_SWSSCOMMON)))
endif
PYTHON3_SWSSCOMMON = python3-swsscommon_$(LIBSWSSCOMMON_VERSION)_$(CONFIGURED_ARCH).deb PYTHON3_SWSSCOMMON = python3-swsscommon_$(LIBSWSSCOMMON_VERSION)_$(CONFIGURED_ARCH).deb
$(eval $(call add_derived_package,$(LIBSWSSCOMMON),$(PYTHON3_SWSSCOMMON))) $(eval $(call add_derived_package,$(LIBSWSSCOMMON),$(PYTHON3_SWSSCOMMON)))

View File

@ -1,12 +1,12 @@
ifeq ($(ENABLE_PY2_MODULES), y)
SPATH := $($(SWSSSDK_PY2)_SRC_PATH)
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/swsssdk-py2.mk rules/swsssdk-py2.dep
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files))
SPATH := $($(SWSSSDK_PY2)_SRC_PATH) $(SWSSSDK_PY2)_CACHE_MODE := GIT_CONTENT_SHA
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/swsssdk-py2.mk rules/swsssdk-py2.dep $(SWSSSDK_PY2)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) $(SWSSSDK_PY2)_DEP_FILES := $(DEP_FILES)
SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files)) $(SWSSSDK_PY2)_SMDEP_FILES := $(SMDEP_FILES)
$(SWSSSDK_PY2)_SMDEP_PATHS := $(SPATH)
$(SWSSSDK_PY2)_CACHE_MODE := GIT_CONTENT_SHA endif
$(SWSSSDK_PY2)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
$(SWSSSDK_PY2)_DEP_FILES := $(DEP_FILES)
$(SWSSSDK_PY2)_SMDEP_FILES := $(SMDEP_FILES)
$(SWSSSDK_PY2)_SMDEP_PATHS := $(SPATH)

View File

@ -1,7 +1,9 @@
# swsssdk python2 wheel ifeq ($(ENABLE_PY2_MODULES), y)
# swsssdk python2 wheel
SWSSSDK_PY2 = swsssdk-2.0.1-py2-none-any.whl SWSSSDK_PY2 = swsssdk-2.0.1-py2-none-any.whl
$(SWSSSDK_PY2)_SRC_PATH = $(SRC_PATH)/sonic-py-swsssdk $(SWSSSDK_PY2)_SRC_PATH = $(SRC_PATH)/sonic-py-swsssdk
$(SWSSSDK_PY2)_PYTHON_VERSION = 2 $(SWSSSDK_PY2)_PYTHON_VERSION = 2
$(SWSSSDK_PY2)_DEPENDS += $(REDIS_DUMP_LOAD_PY2) $(SWSSSDK_PY2)_DEPENDS += $(REDIS_DUMP_LOAD_PY2)
SONIC_PYTHON_WHEELS += $(SWSSSDK_PY2) SONIC_PYTHON_WHEELS += $(SWSSSDK_PY2)
endif

View File

@ -3,6 +3,9 @@
SWSSSDK_PY3 = swsssdk-2.0.1-py3-none-any.whl SWSSSDK_PY3 = swsssdk-2.0.1-py3-none-any.whl
$(SWSSSDK_PY3)_SRC_PATH = $(SRC_PATH)/sonic-py-swsssdk $(SWSSSDK_PY3)_SRC_PATH = $(SRC_PATH)/sonic-py-swsssdk
$(SWSSSDK_PY3)_PYTHON_VERSION = 3 $(SWSSSDK_PY3)_PYTHON_VERSION = 3
# Synthetic dependency just to avoid race condition $(SWSSSDK_PY3)_DEPENDS += $(REDIS_DUMP_LOAD_PY3)
$(SWSSSDK_PY3)_DEPENDS += $(SWSSSDK_PY2) $(REDIS_DUMP_LOAD_PY3) ifeq ($(ENABLE_PY2_MODULES), y)
# Synthetic dependency just to avoid race condition
$(SWSSSDK_PY3)_DEPENDS += $(SWSSSDK_PY2)
endif
SONIC_PYTHON_WHEELS += $(SWSSSDK_PY3) SONIC_PYTHON_WHEELS += $(SWSSSDK_PY3)

View File

@ -63,6 +63,13 @@ IMAGE_DISTRO := bullseye
IMAGE_DISTRO_DEBS_PATH = $(TARGET_PATH)/debs/$(IMAGE_DISTRO) IMAGE_DISTRO_DEBS_PATH = $(TARGET_PATH)/debs/$(IMAGE_DISTRO)
IMAGE_DISTRO_FILES_PATH = $(TARGET_PATH)/files/$(IMAGE_DISTRO) IMAGE_DISTRO_FILES_PATH = $(TARGET_PATH)/files/$(IMAGE_DISTRO)
# Python 2 packages will not be available in Bullseye
ifeq ($(BLDENV),bullseye)
ENABLE_PY2_MODULES = n
else
ENABLE_PY2_MODULES = y
endif
export BUILD_NUMBER export BUILD_NUMBER
export BUILD_TIMESTAMP export BUILD_TIMESTAMP
export SONIC_IMAGE_VERSION export SONIC_IMAGE_VERSION
@ -640,7 +647,7 @@ $(addprefix $(PYTHON_WHEELS_PATH)/, $(SONIC_PYTHON_WHEELS)) : $(PYTHON_WHEELS_PA
# apply series of patches if exist # apply series of patches if exist
if [ -f ../$(notdir $($*_SRC_PATH)).patch/series ]; then QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; fi if [ -f ../$(notdir $($*_SRC_PATH)).patch/series ]; then QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; fi
# Use pip instead of later setup.py to install dependencies into user home, but uninstall self # Use pip instead of later setup.py to install dependencies into user home, but uninstall self
pip$($*_PYTHON_VERSION) install . && pip$($*_PYTHON_VERSION) uninstall --yes `python setup.py --name` pip$($*_PYTHON_VERSION) install . && pip$($*_PYTHON_VERSION) uninstall --yes `python$($*_PYTHON_VERSION) setup.py --name`
if [ ! "$($*_TEST)" = "n" ]; then python$($*_PYTHON_VERSION) setup.py test $(LOG); fi if [ ! "$($*_TEST)" = "n" ]; then python$($*_PYTHON_VERSION) setup.py test $(LOG); fi
python$($*_PYTHON_VERSION) setup.py bdist_wheel $(LOG) python$($*_PYTHON_VERSION) setup.py bdist_wheel $(LOG)
# clean up # clean up

View File

@ -3,7 +3,7 @@ SHELL = /bin/bash
.SHELLFLAGS += -e .SHELLFLAGS += -e
MAIN_TARGET = $(LIBYANG) MAIN_TARGET = $(LIBYANG)
DERIVED_TARGETS = $(LIBYANG_DEV) $(LIBYANG_DBG) $(LIBYANG_PY2) $(LIBYANG_PY3) $(LIBYANG_CPP) DERIVED_TARGETS = $(LIBYANG_DEV) $(LIBYANG_DBG) $(LIBYANG_PY3) $(LIBYANG_CPP)
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
# Obtaining the libyang # Obtaining the libyang

View File

@ -10,33 +10,6 @@ index fa562dd3..8635ba15 100644
# set default build type if not specified by user # set default build type if not specified by user
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE debug) set(CMAKE_BUILD_TYPE debug)
diff --git a/packages/debian.control.in b/packages/debian.control.in
index da6588b9..fb3ede48 100644
--- a/packages/debian.control.in
+++ b/packages/debian.control.in
@@ -53,3 +53,15 @@ Depends: python3-yang@PACKAGE_PART_NAME@ (=@LIBYANG_VERSION@)
Section: debug
Architecture: any
Description: Debug symbols of python3 bidings of libyang library.
+
+Package: python2-yang@PACKAGE_PART_NAME@
+Depends: @PACKAGE_NAME@ (=@LIBYANG_VERSION@), libyang-cpp@PACKAGE_PART_NAME@ (=@LIBYANG_VERSION@)
+Section: libs
+Architecture: any
+Description: Bindings of libyang library to python2 language.
+
+Package: python2-yang@PACKAGE_PART_NAME@-dbg
+Depends: python2-yang@PACKAGE_PART_NAME@ (=@LIBYANG_VERSION@)
+Section: debug
+Architecture: any
+Description: Debug symbols of python2 bidings of libyang library.
diff --git a/packages/debian.python2-yang.install b/packages/debian.python2-yang.install
new file mode 100644
index 00000000..14ce2f3c
--- /dev/null
+++ b/packages/debian.python2-yang.install
@@ -0,0 +1 @@
+usr/lib/python2.7/dist-packages/*
diff --git a/packages/debian.rules.in b/packages/debian.rules.in diff --git a/packages/debian.rules.in b/packages/debian.rules.in
index d565819e..e92fe4a1 100644 index d565819e..e92fe4a1 100644
--- a/packages/debian.rules.in --- a/packages/debian.rules.in
@ -45,7 +18,7 @@ index d565819e..e92fe4a1 100644
override_dh_strip: override_dh_strip:
dh_strip -plibyang@PACKAGE_PART_NAME@ --dbg-package=libyang@PACKAGE_PART_NAME@-dbg dh_strip -plibyang@PACKAGE_PART_NAME@ --dbg-package=libyang@PACKAGE_PART_NAME@-dbg
dh_strip -plibyang-cpp@PACKAGE_PART_NAME@ --dbg-package=libyang-cpp@PACKAGE_PART_NAME@-dbg dh_strip -plibyang-cpp@PACKAGE_PART_NAME@ --dbg-package=libyang-cpp@PACKAGE_PART_NAME@-dbg
+ dh_strip -ppython2-yang@PACKAGE_PART_NAME@ --dbg-package=python2-yang@PACKAGE_PART_NAME@-dbg + #dh_strip -ppython2-yang@PACKAGE_PART_NAME@ --dbg-package=python2-yang@PACKAGE_PART_NAME@-dbg
dh_strip -ppython3-yang@PACKAGE_PART_NAME@ --dbg-package=python3-yang@PACKAGE_PART_NAME@-dbg dh_strip -ppython3-yang@PACKAGE_PART_NAME@ --dbg-package=python3-yang@PACKAGE_PART_NAME@-dbg
override_dh_auto_configure: override_dh_auto_configure:
@ -57,78 +30,3 @@ index d565819e..e92fe4a1 100644
override_dh_auto_test: override_dh_auto_test:
ctest --output-on-failure ctest --output-on-failure
diff --git a/packages/libyang.dsc.in b/packages/libyang.dsc.in
index fdfa402b..f75ba184 100644
--- a/packages/libyang.dsc.in
+++ b/packages/libyang.dsc.in
@@ -1,10 +1,10 @@
Format: 3.0 (quilt)
Source: @PACKAGE_NAME@
-Binary: @PACKAGE_NAME@, @PACKAGE_NAME@-dbg, @PACKAGE_NAME@-dev, libyang-cpp@PACKAGE_PART_NAME@, libyang-cpp@PACKAGE_PART_NAME@-dev, libyang-cpp@PACKAGE_PART_NAME@-dbg, python3-yang@PACKAGE_PART_NAME@, python3-yang@PACKAGE_PART_NAME@-dbg
+Binary: @PACKAGE_NAME@, @PACKAGE_NAME@-dbg, @PACKAGE_NAME@-dev, libyang-cpp@PACKAGE_PART_NAME@, libyang-cpp@PACKAGE_PART_NAME@-dev, libyang-cpp@PACKAGE_PART_NAME@-dbg, python3-yang@PACKAGE_PART_NAME@, python3-yang@PACKAGE_PART_NAME@-dbg python2-yang@PACKAGE_PART_NAME@, python2-yang@PACKAGE_PART_NAME@-dbg
Maintainer: CESNET <rkrejci@cesnet.cz>
Version: @LIBYANG_VERSION@
Architecture: any
Standards-Version: 3.8.2
Homepage: https://github.com/CESNET/libyang
Vcs-Git: https://github.com/CESNET/libyang
-Build-Depends: debhelper (>= 9), make, gcc, doxygen, cmake, pkg-config, libpcre3-dev, libcmocka-dev, python3-dev, g++, swig (>= 3.0.12)
+Build-Depends: debhelper (>= 9), make, gcc, doxygen, cmake, pkg-config, libpcre3-dev, libcmocka-dev, python3-dev, python2-dev, g++, swig (>= 3.0.12)
diff --git a/packages/libyang.spec.in b/packages/libyang.spec.in
index 6a4ac615..6939f028 100644
--- a/packages/libyang.spec.in
+++ b/packages/libyang.spec.in
@@ -46,6 +46,8 @@ BuildRequires: python3-devel
%else
BuildRequires: python34-devel
%endif
+
+BuildRequires: python2-devel
%endif
Conflicts: @CONFLICT_PACKAGE_NAME@ = @LIBYANG_MAJOR_VERSION@.@LIBYANG_MINOR_VERSION@
@@ -70,6 +72,11 @@ Summary: Binding to python
Requires: libyang-cpp@PACKAGE_PART_NAME@ = %{version}-%{release}
Requires: %{name} = %{version}-%{release}
+%package -n python2-yang@PACKAGE_PART_NAME@
+Summary: Binding to python
+Requires: libyang-cpp@PACKAGE_PART_NAME@ = %{version}-%{release}
+Requires: %{name} = %{version}-%{release}
+
%description -n libyang-cpp@PACKAGE_PART_NAME@
Bindings of libyang library to C++ language.
@@ -80,6 +87,10 @@ Headers of bindings to c++ language.
Bindings of libyang library to python language.
%endif
+%description -n python2-yang@PACKAGE_PART_NAME@
+Bindings of libyang library to python language.
+%endif
+
%description devel
Headers of libyang library.
@@ -167,4 +178,9 @@ make DESTDIR=%{buildroot} install
%{_libdir}/python*
%endif
+%files -n python2-yang@PACKAGE_PART_NAME@
+%defattr(-,root,root)
+%{_libdir}/python*
+%endif
+
%changelog
diff --git a/packages/local-deb.sh.in b/packages/local-deb.sh.in
index 057bbc67..4318a49d 100755
--- a/packages/local-deb.sh.in
+++ b/packages/local-deb.sh.in
@@ -18,6 +18,7 @@ fi
cp "@PROJECT_SOURCE_DIR@/packages/debian.libyang-dev.install" debian/@PACKAGE_NAME@-dev.install
cp "@PROJECT_SOURCE_DIR@/packages/debian.libyang-cpp.install" debian/libyang-cpp@PACKAGE_PART_NAME@.install
cp "@PROJECT_SOURCE_DIR@/packages/debian.libyang-cpp-dev.install" debian/libyang-cpp@PACKAGE_PART_NAME@-dev.install
+cp "@PROJECT_SOURCE_DIR@/packages/debian.python2-yang.install" debian/python2-yang@PACKAGE_PART_NAME@.install
cp "@PROJECT_SOURCE_DIR@/packages/debian.python3-yang.install" debian/python3-yang@PACKAGE_PART_NAME@.install
echo -e "@PACKAGE_NAME@ (@LIBYANG_VERSION@) stable; urgency=low\n" >debian/changelog
git log -10 --pretty=format:' * %s (%aN)%n' 2>/dev/null >>debian/changelog || echo -e " * unknown changes \n" >>debian/changelog

View File

@ -29,7 +29,7 @@ index 4cee36ec..0baa69ab 100644
+ message(WARNING "Can't create a static Python module") + message(WARNING "Can't create a static Python module")
else() else()
- message(WARNING "Sysrepo supports Python 2.x and Python 3.x") - message(WARNING "Sysrepo supports Python 2.x and Python 3.x")
+ set(GEN_PYTHON_VERSION 2 3) + set(GEN_PYTHON_VERSION 3)
+ foreach(CUR_PYTHON_VERSION ${GEN_PYTHON_VERSION}) + foreach(CUR_PYTHON_VERSION ${GEN_PYTHON_VERSION})
+ message(STATUS "Python version ${CUR_PYTHON_VERSION} was selected") + message(STATUS "Python version ${CUR_PYTHON_VERSION} was selected")
+ +
@ -99,7 +99,7 @@ index 994b1234..5d18b8bf 100644
-swig_link_libraries(${PYTHON_SWIG_BINDING} ${PYTHON_LIBRARIES} libyang-cpp) -swig_link_libraries(${PYTHON_SWIG_BINDING} ${PYTHON_LIBRARIES} libyang-cpp)
+swig_link_libraries(${PYTHON_SWIG_TARGET} ${PYTHON_LIBRARIES} libyang-cpp) +swig_link_libraries(${PYTHON_SWIG_TARGET} ${PYTHON_LIBRARIES} libyang-cpp)
+ +
+set_target_properties(_${PYTHON_SWIG_TARGET} PROPERTIES OUTPUT_NAME "_yang${PYTHON_EXT_SUFFIX}" SUFFIX "") +set_target_properties(_${PYTHON_SWIG_TARGET} PROPERTIES OUTPUT_NAME "_yang")
# Generate header with SWIG run-time functions # Generate header with SWIG run-time functions
execute_process(COMMAND ${SWIG_EXECUTABLE} -python -external-runtime ${CMAKE_CURRENT_BINARY_DIR}/swigpyrun.h) execute_process(COMMAND ${SWIG_EXECUTABLE} -python -external-runtime ${CMAKE_CURRENT_BINARY_DIR}/swigpyrun.h)