Skip to content

Commit

Permalink
python wheel cffi: try to use setarch to force armhf instead of armv8l
Browse files Browse the repository at this point in the history
  • Loading branch information
bradh352 committed Feb 8, 2025
1 parent 9bf5a22 commit 801cc52
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
7 changes: 7 additions & 0 deletions Makefile.work
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ $(shell rm -f .screen)
MAKEFLAGS += -B

CONFIGURED_ARCH := $(shell [ -f .arch ] && cat .arch || echo $(PLATFORM_ARCH))
echo "Configured Arch: $(CONFIGURED_ARCH)"
CONFIGURED_PLATFORM = $(if $(PLATFORM),$(PLATFORM),$(shell cat .platform 2>/dev/null))
ifeq ($(CONFIGURED_ARCH),)
override CONFIGURED_ARCH = amd64
Expand Down Expand Up @@ -162,6 +163,8 @@ ifeq ($(LEGACY_SONIC_MGMT_DOCKER),)
override LEGACY_SONIC_MGMT_DOCKER = y
endif

SETARCH =

ifeq ($(CONFIGURED_ARCH),amd64)
SLAVE_BASE_IMAGE = $(SLAVE_DIR)
MULTIARCH_QEMU_ENVIRON = n
Expand All @@ -171,6 +174,9 @@ ifeq ($(CONFIGURED_ARCH), $(COMPILE_HOST_ARCH))
SLAVE_BASE_IMAGE = $(SLAVE_DIR)
MULTIARCH_QEMU_ENVIRON = n
CROSS_BUILD_ENVIRON = n
ifeq ($(CONFIGURED_ARCH), armhf)
SETARCH = setarch armhf
endif
else ifneq ($(CONFIGURED_ARCH),)
SLAVE_BASE_IMAGE = $(SLAVE_DIR)-march-$(CONFIGURED_ARCH)
ifneq ($(CROSS_BLDENV),)
Expand All @@ -185,6 +191,7 @@ endif
SLAVE_IMAGE = $(SLAVE_BASE_IMAGE)-$(USER_LC)
DOCKER_ROOT = $(PWD)/fsroot.docker.$(BLDENV)


ifeq ($(INCLUDE_FIPS), n)
ifeq ($(ENABLE_FIPS), y)
$(error Cannot set fips config ENABLE_FIPS=y when INCLUDE_FIPS=n)
Expand Down
4 changes: 2 additions & 2 deletions rules/libyang3-py3.mk
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# libyang python3 wheel

LIBYANG3_PY3_VERSION = 3.0.3
LIBYANG3_PY3_ABI := cp$(shell python3 -c "import sysconfig; print(sysconfig.get_python_version().replace('.',''))")
LIBYANG3_PY3_PLAT := $(shell python3 -c "import sysconfig; print(sysconfig.get_platform().replace('.','_').replace('-','_'))")
LIBYANG3_PY3_ABI := cp$(shell $(SETARCH) python3 -c "import sysconfig; print(sysconfig.get_python_version().replace('.',''))")
LIBYANG3_PY3_PLAT := $(shell $(SETARCH) python3 -c "import sysconfig; print(sysconfig.get_platform().replace('.','_').replace('-','_'))")
LIBYANG3_PY3 := libyang-$(LIBYANG3_PY3_VERSION)-$(LIBYANG3_PY3_ABI)-$(LIBYANG3_PY3_ABI)-$(LIBYANG3_PY3_PLAT).whl
$(LIBYANG3_PY3)_SRC_PATH = $(SRC_PATH)/libyang3-py3
$(LIBYANG3_PY3)_PYTHON_VERSION = 3
Expand Down
10 changes: 5 additions & 5 deletions slave.mk
Original file line number Diff line number Diff line change
Expand Up @@ -958,13 +958,13 @@ $(addprefix $(PYTHON_WHEELS_PATH)/, $(SONIC_PYTHON_WHEELS)) : $(PYTHON_WHEELS_PA
if [ -f ../$(notdir $($*_SRC_PATH)).patch/series ]; then ( quilt pop -a -f 1>/dev/null 2>&1 || true ) && QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; fi $(LOG)
ifneq ($(CROSS_BUILD_ENVIRON),y)
# 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$($*_PYTHON_VERSION) setup.py --name`; } $(LOG)
{ $(SETARCH) pip$($*_PYTHON_VERSION) install . && $(SETARCH) pip$($*_PYTHON_VERSION) uninstall --yes `python$($*_PYTHON_VERSION) setup.py --name`; } $(LOG)
ifeq ($(BLDENV),bookworm)
if [ ! "$($*_TEST)" = "n" ]; then pip$($*_PYTHON_VERSION) install ".[testing]" && timeout --preserve-status -s 9 -k 10 $(BUILD_PROCESS_TIMEOUT) python$($*_PYTHON_VERSION) -m pytest && pip$($*_PYTHON_VERSION) uninstall --yes `python$($*_PYTHON_VERSION) setup.py --name`; fi $(LOG)
python$($*_PYTHON_VERSION) -m build -n -w $(LOG)
if [ ! "$($*_TEST)" = "n" ]; then $(SETARCH) pip$($*_PYTHON_VERSION) install ".[testing]" && timeout --preserve-status -s 9 -k 10 $(BUILD_PROCESS_TIMEOUT) python$($*_PYTHON_VERSION) -m pytest && $(SETARCH) pip$($*_PYTHON_VERSION) uninstall --yes `python$($*_PYTHON_VERSION) setup.py --name`; fi $(LOG)
$(SETARCH) python$($*_PYTHON_VERSION) -m build -n -w $(LOG)
else
if [ ! "$($*_TEST)" = "n" ]; then timeout --preserve-status -s 9 -k 10 $(BUILD_PROCESS_TIMEOUT) python$($*_PYTHON_VERSION) setup.py test $(LOG); fi
python$($*_PYTHON_VERSION) setup.py bdist_wheel $(LOG)
if [ ! "$($*_TEST)" = "n" ]; then $(SETARCH) timeout --preserve-status -s 9 -k 10 $(BUILD_PROCESS_TIMEOUT) python$($*_PYTHON_VERSION) setup.py test $(LOG); fi
$(SETARCH) python$($*_PYTHON_VERSION) setup.py bdist_wheel $(LOG)
endif
else
{
Expand Down

0 comments on commit 801cc52

Please sign in to comment.