interpreters/python: support build without network

Adds options to support building when CONFIG_NET is not set.
This allows building Python for boards that do not have networking support.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
This commit is contained in:
Filipe Cavalcanti 2026-07-15 14:11:49 -03:00 committed by Xiang Xiao
parent 62d04ed484
commit 09682dad05

View file

@ -119,6 +119,13 @@ ifeq ($(CONFIG_SYSTEM_SYSTEM),y)
else
@echo "export ac_cv_func_system=\"no\"" >> $@
endif
ifeq ($(CONFIG_NET),y)
@echo "export ac_cv_func_getaddrinfo=\"yes\"" >> $@
@echo "export ac_cv_func_getnameinfo=\"yes\"" >> $@
else
@echo "export ac_cv_func_getaddrinfo=\"no\"" >> $@
@echo "export ac_cv_func_getnameinfo=\"no\"" >> $@
endif
# The `Setup.local` file enables or disables Python modules.
# Depending on the features enabled on NuttX, this file may need to be
@ -134,6 +141,9 @@ endif
ifneq ($(CONFIG_LIBC_DLFCN),y)
@echo "_ctypes" >> $@
endif
ifneq ($(CONFIG_NET),y)
@echo "_socket" >> $@
endif
# For the Python's `configure` script, please consider the following
# when building for NuttX:
@ -146,6 +156,12 @@ endif
# Python/Modules/getpath.c (issue will be filed soon to track this
# problem).
ifneq ($(CONFIG_NET),y)
PYTHON_CONFIGURE_EXTRAS = --disable-ipv6
else
PYTHON_CONFIGURE_EXTRAS =
endif
$(TARGETBUILD)/Makefile: $(HOSTPYTHON) $(CONFIG_SITE) $(SETUP_LOCAL)
$(Q) mkdir -p $(TARGETBUILD)/Modules
$(Q) mkdir -p $(TARGETMODULES)/python$(CPYTHON_VERSION_MINOR)
@ -175,6 +191,7 @@ $(TARGETBUILD)/Makefile: $(HOSTPYTHON) $(CONFIG_SITE) $(SETUP_LOCAL)
--without-pymalloc \
--disable-test-modules \
--with-ensurepip=no \
$(PYTHON_CONFIGURE_EXTRAS) \
)
$(Q) sed -i 's/^#define HAVE_LIBB2 1/\/* #undef HAVE_LIBB2 *\//' $(TARGETBUILD)/pyconfig.h
$(Q) sed -i 's/-lb2//g' $(TARGETBUILD)/Makefile