This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 09682dad0 interpreters/python: support build without network
09682dad0 is described below

commit 09682dad05378607e537a92279883cdc6f8e4a38
Author: Filipe Cavalcanti <[email protected]>
AuthorDate: Wed Jul 15 14:11:49 2026 -0300

    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 <[email protected]>
---
 interpreters/python/Makefile | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/interpreters/python/Makefile b/interpreters/python/Makefile
index c3acd5188..bac4013f8 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

Reply via email to