diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index deb34dd302..7ea305d18c 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -102,25 +102,19 @@ sudo mkdir -p $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/ifupdown2_*.deb || \ 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') -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') +# Install a patched 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 LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y \ -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install -f # Install dependencies for SONiC config engine sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install \ - python-dev \ python3-dev # Install j2cli for handling jinja template sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install "j2cli==0.3.10" # 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" # 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 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 sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install psutil # 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 # 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 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 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 @@ -180,7 +155,6 @@ fi # 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-cpp_*.deb -sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/python2-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}}) 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 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 # 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 @@ -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 -# 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 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 @@ -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 {% 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 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 @@ -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 #} {% 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 {% 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 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 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 diff --git a/platform/pddf/platform-api-pddf-base.mk b/platform/pddf/platform-api-pddf-base.mk index ce818707ba..673dfcd3e3 100644 --- a/platform/pddf/platform-api-pddf-base.mk +++ b/platform/pddf/platform-api-pddf-base.mk @@ -5,22 +5,26 @@ PDDF_PLATFORM_API_BASE_VERSION = 1.0 export PDDF_PLATFORM_API_BASE_VERSION -PDDF_PLATFORM_API_BASE_PY2 = sonic_platform_pddf_common-$(PDDF_PLATFORM_API_BASE_VERSION)-py2-none-any.whl -$(PDDF_PLATFORM_API_BASE_PY2)_SRC_PATH = $(PLATFORM_PDDF_PATH)/platform-api-pddf-base -$(PDDF_PLATFORM_API_BASE_PY2)_PYTHON_VERSION = 2 -$(PDDF_PLATFORM_API_BASE_PY2)_DEPENDS = $(SONIC_CONFIG_ENGINE) -SONIC_PYTHON_WHEELS += $(PDDF_PLATFORM_API_BASE_PY2) +ifeq ($(ENABLE_PY2_MODULES), y) + PDDF_PLATFORM_API_BASE_PY2 = sonic_platform_pddf_common-$(PDDF_PLATFORM_API_BASE_VERSION)-py2-none-any.whl + $(PDDF_PLATFORM_API_BASE_PY2)_SRC_PATH = $(PLATFORM_PDDF_PATH)/platform-api-pddf-base + $(PDDF_PLATFORM_API_BASE_PY2)_PYTHON_VERSION = 2 + $(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 + export pddf_platform_api_base_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(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)_SRC_PATH = $(PLATFORM_PDDF_PATH)/platform-api-pddf-base $(PDDF_PLATFORM_API_BASE_PY3)_PYTHON_VERSION = 3 $(PDDF_PLATFORM_API_BASE_PY3)_DEPENDS = $(SONIC_CONFIG_ENGINE) -# Synthetic dependency to avoid building the Python 2 and 3 packages -# simultaneously and any potential conflicts which may arise -$(PDDF_PLATFORM_API_BASE_PY3)_DEPENDS += $(PDDF_PLATFORM_API_BASE_PY2) +ifeq ($(ENABLE_PY2_MODULES), y) + # Synthetic dependency to avoid building the Python 2 and 3 packages + # 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 SONIC_PYTHON_WHEELS += $(PDDF_PLATFORM_API_BASE_PY3) diff --git a/platform/vs/docker-sonic-vs.mk b/platform/vs/docker-sonic-vs.mk index 01459d1c9d..5d50d24094 100644 --- a/platform/vs/docker-sonic-vs.mk +++ b/platform/vs/docker-sonic-vs.mk @@ -11,7 +11,6 @@ $(DOCKER_SONIC_VS)_DEPENDS += $(SWSS) \ $(SONIC_DEVICE_DATA) \ $(LIBYANG) \ $(LIBYANG_CPP) \ - $(LIBYANG_PY2) \ $(LIBYANG_PY3) \ $(SONIC_UTILITIES_DATA) \ $(SONIC_HOST_SERVICES_DATA) diff --git a/rules/libyang.mk b/rules/libyang.mk index 181db2368c..c8873c3b32 100644 --- a/rules/libyang.mk +++ b/rules/libyang.mk @@ -29,11 +29,7 @@ LIBYANG_PY3 = python3-yang_$(LIBYANG_VERSION)_$(CONFIGURED_ARCH).deb $(LIBYANG_PY3)_DEPENDS += $(LIBYANG) $(LIBYANG_CPP) $(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_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 diff --git a/rules/redis-dump-load-py2.dep b/rules/redis-dump-load-py2.dep index adc43905b7..a1293f9fb6 100644 --- a/rules/redis-dump-load-py2.dep +++ b/rules/redis-dump-load-py2.dep @@ -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) -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)) - -$(REDIS_DUMP_LOAD_PY2)_CACHE_MODE := GIT_CONTENT_SHA -$(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) - + $(REDIS_DUMP_LOAD_PY2)_CACHE_MODE := GIT_CONTENT_SHA + $(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) +endif diff --git a/rules/redis-dump-load-py2.mk b/rules/redis-dump-load-py2.mk index 5f756caada..7330c8027a 100644 --- a/rules/redis-dump-load-py2.mk +++ b/rules/redis-dump-load-py2.mk @@ -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)_SRC_PATH = $(SRC_PATH)/redis-dump-load -$(REDIS_DUMP_LOAD_PY2)_PYTHON_VERSION = 2 -SONIC_PYTHON_WHEELS += $(REDIS_DUMP_LOAD_PY2) + 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)_PYTHON_VERSION = 2 + SONIC_PYTHON_WHEELS += $(REDIS_DUMP_LOAD_PY2) +endif diff --git a/rules/redis-dump-load-py3.mk b/rules/redis-dump-load-py3.mk index 875b5e1c81..fe2b8688e4 100644 --- a/rules/redis-dump-load-py3.mk +++ b/rules/redis-dump-load-py3.mk @@ -3,7 +3,9 @@ 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)_PYTHON_VERSION = 3 -# Synthetic dependency just to avoid race condition -$(REDIS_DUMP_LOAD_PY3)_DEPENDS += $(REDIS_DUMP_LOAD_PY2) +ifeq ($(ENABLE_PY2_MODULES), y) + # Synthetic dependency just to avoid race condition + $(REDIS_DUMP_LOAD_PY3)_DEPENDS += $(REDIS_DUMP_LOAD_PY2) +endif $(REDIS_DUMP_LOAD_PY3)_TEST = n SONIC_PYTHON_WHEELS += $(REDIS_DUMP_LOAD_PY3) diff --git a/rules/sonic-config.dep b/rules/sonic-config.dep index ae8569326e..05a02a6027 100644 --- a/rules/sonic-config.dep +++ b/rules/sonic-config.dep @@ -1,14 +1,16 @@ # 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_BASE_FILES_LIST) 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 -$(SONIC_CONFIG_ENGINE_PY2)_CACHE_MODE := GIT_CONTENT_SHA -$(SONIC_CONFIG_ENGINE_PY2)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) -$(SONIC_CONFIG_ENGINE_PY2)_DEP_FILES := $(DEP_FILES) +ifeq ($(ENABLE_PY2_MODULES), y) + $(SONIC_CONFIG_ENGINE_PY2)_CACHE_MODE := GIT_CONTENT_SHA + $(SONIC_CONFIG_ENGINE_PY2)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) + $(SONIC_CONFIG_ENGINE_PY2)_DEP_FILES := $(DEP_FILES) +endif # SONIC_CONFIG_ENGINE_PY3 package diff --git a/rules/sonic-config.mk b/rules/sonic-config.mk index 373604e965..ba146df705 100644 --- a/rules/sonic-config.mk +++ b/rules/sonic-config.mk @@ -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)_SRC_PATH = $(SRC_PATH)/sonic-config-engine -$(SONIC_CONFIG_ENGINE_PY2)_DEPENDS += $(SONIC_PY_COMMON_PY2) -$(SONIC_CONFIG_ENGINE_PY2)_DEBS_DEPENDS += $(PYTHON_SWSSCOMMON) -$(SONIC_CONFIG_ENGINE_PY2)_PYTHON_VERSION = 2 -SONIC_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY2) + 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)_DEPENDS += $(SONIC_PY_COMMON_PY2) + $(SONIC_CONFIG_ENGINE_PY2)_DEBS_DEPENDS += $(PYTHON_SWSSCOMMON) + $(SONIC_CONFIG_ENGINE_PY2)_PYTHON_VERSION = 2 + SONIC_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY2) +endif # SONIC_CONFIG_ENGINE_PY3 package @@ -18,8 +20,10 @@ $(SONIC_CONFIG_ENGINE_PY3)_DEBS_DEPENDS += $(LIBYANG) \ $(LIBYANG_CPP) \ $(LIBYANG_PY3) \ $(PYTHON3_SWSSCOMMON) -# Synthetic dependency to avoid building the Python 2 and 3 packages -# simultaneously and any potential conflicts which may arise -$(SONIC_CONFIG_ENGINE_PY3)_DEPENDS += $(SONIC_CONFIG_ENGINE_PY2) +ifeq ($(ENABLE_PY2_MODULES), y) + # Synthetic dependency to avoid building the Python 2 and 3 packages + # 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_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY3) diff --git a/rules/sonic-platform-common.dep b/rules/sonic-platform-common.dep index e921c4df01..632c92c1ac 100644 --- a/rules/sonic-platform-common.dep +++ b/rules/sonic-platform-common.dep @@ -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_BASE_FILES_LIST) 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 -$(SONIC_PLATFORM_COMMON_PY2)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) -$(SONIC_PLATFORM_COMMON_PY2)_DEP_FILES := $(DEP_FILES) -$(SONIC_PLATFORM_COMMON_PY2)_SMDEP_FILES := $(SMDEP_FILES) -$(SONIC_PLATFORM_COMMON_PY2)_SMDEP_PATHS := $(SPATH) - +ifeq ($(ENABLE_PY2_MODULES), y) + $(SONIC_PLATFORM_COMMON_PY2)_CACHE_MODE := GIT_CONTENT_SHA + $(SONIC_PLATFORM_COMMON_PY2)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) + $(SONIC_PLATFORM_COMMON_PY2)_DEP_FILES := $(DEP_FILES) + $(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 diff --git a/rules/sonic-platform-common.mk b/rules/sonic-platform-common.mk index 25ab5ff839..09ce14faab 100644 --- a/rules/sonic-platform-common.mk +++ b/rules/sonic-platform-common.mk @@ -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)_SRC_PATH = $(SRC_PATH)/sonic-platform-common -$(SONIC_PLATFORM_COMMON_PY2)_PYTHON_VERSION = 2 -$(SONIC_PLATFORM_COMMON_PY2)_DEPENDS += $(SONIC_PY_COMMON_PY2) $(SONIC_CONFIG_ENGINE_PY2) -$(SONIC_PLATFORM_COMMON_PY2)_DEBS_DEPENDS += $(PYTHON_SWSSCOMMON) -SONIC_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY2) + 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)_PYTHON_VERSION = 2 + $(SONIC_PLATFORM_COMMON_PY2)_DEPENDS += $(SONIC_PY_COMMON_PY2) $(SONIC_CONFIG_ENGINE_PY2) + $(SONIC_PLATFORM_COMMON_PY2)_DEBS_DEPENDS += $(PYTHON_SWSSCOMMON) + 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 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)_DEPENDS += $(SONIC_PY_COMMON_PY3) $(SONIC_CONFIG_ENGINE_PY3) $(SONIC_PLATFORM_COMMON_PY3)_DEBS_DEPENDS += $(PYTHON3_SWSSCOMMON) -# Synthetic dependency just to avoid race condition -$(SONIC_PLATFORM_COMMON_PY3)_DEPENDS += $(SONIC_PLATFORM_COMMON_PY2) +ifeq ($(ENABLE_PY2_MODULES), y) + # Synthetic dependency just to avoid race condition + $(SONIC_PLATFORM_COMMON_PY3)_DEPENDS += $(SONIC_PLATFORM_COMMON_PY2) +endif SONIC_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY3) diff --git a/rules/sonic-py-common.dep b/rules/sonic-py-common.dep index 9ecedb068a..b3d08c5d86 100644 --- a/rules/sonic-py-common.dep +++ b/rules/sonic-py-common.dep @@ -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_BASE_FILES_LIST) DEP_FILES += $(shell git ls-files $(SPATH)) -$(SONIC_PY_COMMON_PY2)_CACHE_MODE := GIT_CONTENT_SHA -$(SONIC_PY_COMMON_PY2)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) -$(SONIC_PY_COMMON_PY2)_DEP_FILES := $(DEP_FILES) +ifeq ($(ENABLE_PY2_MODULES), y) + $(SONIC_PY_COMMON_PY2)_CACHE_MODE := GIT_CONTENT_SHA + $(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)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) diff --git a/rules/sonic-py-common.mk b/rules/sonic-py-common.mk index 6afe9a826c..be5f5d8e69 100644 --- a/rules/sonic-py-common.mk +++ b/rules/sonic-py-common.mk @@ -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)_SRC_PATH = $(SRC_PATH)/sonic-py-common -$(SONIC_PY_COMMON_PY2)_DEPENDS += $(SWSSSDK_PY2) -$(SONIC_PY_COMMON_PY2)_PYTHON_VERSION = 2 -SONIC_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY2) + 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)_DEPENDS += $(SWSSSDK_PY2) + $(SONIC_PY_COMMON_PY2)_PYTHON_VERSION = 2 + SONIC_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY2) +endif # SONIC_PY_COMMON_PY3 package 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)_DEPENDS += $(SWSSSDK_PY3) -# Synthetic dependency to avoid building the Python 2 and 3 packages -# simultaneously and any potential conflicts which may arise -$(SONIC_PY_COMMON_PY3)_DEPENDS += $(SONIC_PY_COMMON_PY2) +ifeq ($(ENABLE_PY2_MODULES), y) + # Synthetic dependency to avoid building the Python 2 and 3 packages + # 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_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY3) diff --git a/rules/sonic-yang-models-py3.mk b/rules/sonic-yang-models-py3.mk index 8c11a921a9..f5a606c28c 100644 --- a/rules/sonic-yang-models-py3.mk +++ b/rules/sonic-yang-models-py3.mk @@ -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)_PYTHON_VERSION = 3 $(SONIC_YANG_MODELS_PY3)_DEBS_DEPENDS = $(LIBYANG) $(LIBYANG_CPP) \ - $(LIBYANG_PY2) $(LIBYANG_PY3) + $(LIBYANG_PY3) SONIC_PYTHON_WHEELS += $(SONIC_YANG_MODELS_PY3) export SONIC_YANG_MODELS_PY3 diff --git a/rules/swss-common.mk b/rules/swss-common.mk index 09dc312277..83a8d0f19c 100644 --- a/rules/swss-common.mk +++ b/rules/swss-common.mk @@ -17,8 +17,10 @@ SONIC_DPKG_DEBS += $(LIBSWSSCOMMON) LIBSWSSCOMMON_DEV = $(LIBSWSSCOMMON_NAME)-dev_$(LIBSWSSCOMMON_VERSION)_$(CONFIGURED_ARCH).deb $(eval $(call add_derived_package,$(LIBSWSSCOMMON),$(LIBSWSSCOMMON_DEV))) -PYTHON_SWSSCOMMON = python-swsscommon_$(LIBSWSSCOMMON_VERSION)_$(CONFIGURED_ARCH).deb -$(eval $(call add_derived_package,$(LIBSWSSCOMMON),$(PYTHON_SWSSCOMMON))) +ifeq ($(ENABLE_PY2_MODULES), y) + 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 $(eval $(call add_derived_package,$(LIBSWSSCOMMON),$(PYTHON3_SWSSCOMMON))) diff --git a/rules/swsssdk-py2.dep b/rules/swsssdk-py2.dep index 2be9565fed..300d3cdeb0 100644 --- a/rules/swsssdk-py2.dep +++ b/rules/swsssdk-py2.dep @@ -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) -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)) - -$(SWSSSDK_PY2)_CACHE_MODE := GIT_CONTENT_SHA -$(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) - + $(SWSSSDK_PY2)_CACHE_MODE := GIT_CONTENT_SHA + $(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) +endif diff --git a/rules/swsssdk-py2.mk b/rules/swsssdk-py2.mk index 8a98d1feda..7a7a1cd870 100644 --- a/rules/swsssdk-py2.mk +++ b/rules/swsssdk-py2.mk @@ -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)_SRC_PATH = $(SRC_PATH)/sonic-py-swsssdk -$(SWSSSDK_PY2)_PYTHON_VERSION = 2 -$(SWSSSDK_PY2)_DEPENDS += $(REDIS_DUMP_LOAD_PY2) -SONIC_PYTHON_WHEELS += $(SWSSSDK_PY2) + SWSSSDK_PY2 = swsssdk-2.0.1-py2-none-any.whl + $(SWSSSDK_PY2)_SRC_PATH = $(SRC_PATH)/sonic-py-swsssdk + $(SWSSSDK_PY2)_PYTHON_VERSION = 2 + $(SWSSSDK_PY2)_DEPENDS += $(REDIS_DUMP_LOAD_PY2) + SONIC_PYTHON_WHEELS += $(SWSSSDK_PY2) +endif diff --git a/rules/swsssdk-py3.mk b/rules/swsssdk-py3.mk index 681ba72f85..4e42652211 100644 --- a/rules/swsssdk-py3.mk +++ b/rules/swsssdk-py3.mk @@ -3,6 +3,9 @@ SWSSSDK_PY3 = swsssdk-2.0.1-py3-none-any.whl $(SWSSSDK_PY3)_SRC_PATH = $(SRC_PATH)/sonic-py-swsssdk $(SWSSSDK_PY3)_PYTHON_VERSION = 3 -# Synthetic dependency just to avoid race condition -$(SWSSSDK_PY3)_DEPENDS += $(SWSSSDK_PY2) $(REDIS_DUMP_LOAD_PY3) +$(SWSSSDK_PY3)_DEPENDS += $(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) diff --git a/slave.mk b/slave.mk index 78d39fa209..8f40396cb5 100644 --- a/slave.mk +++ b/slave.mk @@ -63,6 +63,13 @@ IMAGE_DISTRO := bullseye IMAGE_DISTRO_DEBS_PATH = $(TARGET_PATH)/debs/$(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_TIMESTAMP export SONIC_IMAGE_VERSION @@ -640,7 +647,7 @@ $(addprefix $(PYTHON_WHEELS_PATH)/, $(SONIC_PYTHON_WHEELS)) : $(PYTHON_WHEELS_PA # apply series of patches if exist 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 - 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 python$($*_PYTHON_VERSION) setup.py bdist_wheel $(LOG) # clean up diff --git a/src/libyang/Makefile b/src/libyang/Makefile index 32cabdf13b..357908ebc3 100644 --- a/src/libyang/Makefile +++ b/src/libyang/Makefile @@ -3,7 +3,7 @@ SHELL = /bin/bash .SHELLFLAGS += -e 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)/% : # Obtaining the libyang diff --git a/src/libyang/patch/libyang.patch b/src/libyang/patch/libyang.patch index a950d85086..45eba825ce 100644 --- a/src/libyang/patch/libyang.patch +++ b/src/libyang/patch/libyang.patch @@ -10,33 +10,6 @@ index fa562dd3..8635ba15 100644 # set default build type if not specified by user if(NOT CMAKE_BUILD_TYPE) 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 index d565819e..e92fe4a1 100644 --- a/packages/debian.rules.in @@ -45,7 +18,7 @@ index d565819e..e92fe4a1 100644 override_dh_strip: 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 -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 override_dh_auto_configure: @@ -57,78 +30,3 @@ index d565819e..e92fe4a1 100644 override_dh_auto_test: 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 - 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 diff --git a/src/libyang/patch/swig.patch b/src/libyang/patch/swig.patch index a6f798c182..d2b4080d36 100644 --- a/src/libyang/patch/swig.patch +++ b/src/libyang/patch/swig.patch @@ -29,7 +29,7 @@ index 4cee36ec..0baa69ab 100644 + message(WARNING "Can't create a static Python module") else() - 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}) + 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_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 execute_process(COMMAND ${SWIG_EXECUTABLE} -python -external-runtime ${CMAKE_CURRENT_BINARY_DIR}/swigpyrun.h)