From 33877c0f3cc30fbb53874b6112e690db66cda408 Mon Sep 17 00:00:00 2001 From: Filipe Cavalcanti Date: Wed, 15 Jul 2026 14:11:49 -0300 Subject: [PATCH] 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 --- interpreters/python/Makefile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/interpreters/python/Makefile b/interpreters/python/Makefile index c3acd518868..bac4013f886 100644 --- a/interpreters/python/Makefile +++ b/interpreters/python/Makefile @@ -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