python3: enable bluetooth support by default
authorAlexandru Ardelean <redacted>
Sat, 25 Sep 2021 08:18:51 +0000 (11:18 +0300)
committerRosen Penev <redacted>
Mon, 27 Sep 2021 18:01:07 +0000 (11:01 -0700)
Bluetooth support requires bluez-libs present, but they are only required
for the build, and don't seem to be needed to be present on the target.

There isn't any linking required to libbluetooth. It's only the bluetooth.h
header that is required for building BT support into Python.

For testing, this snippet was used from `Lib/test/test_socket.py` (inside
cpython):
```
def _have_socket_bluetooth():
    """Check whether AF_BLUETOOTH sockets are supported on this host."""
    try:
        # RFCOMM is supported by all platforms with bluetooth support. Windows
        # does not support omitting the protocol.
        s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_STREAM, socket.BTPROTO_RFCOMM)
    except (AttributeError, OSError):
        return False
    else:
        s.close()
    return True
```

Fixes: https://github.com/openwrt/packages/issues/16544
Signed-off-by: Alexandru Ardelean <redacted>
lang/python/python3/Config-python3-light.in
lang/python/python3/Makefile

index db0a301084f7cca25f04151695a947898eed02cb..968c3472cf4f9db5093c9a4375f5c5cc60456533 100644 (file)
@@ -1,9 +1,5 @@
 menu "Configuration"
 
-config PYTHON3_BLUETOOTH_SUPPORT
-       bool "Enable Bluetooth support"
-       default n
-
 config PYTHON3_HOST_PIP_CACHE_WORLD_READABLE
        bool "Ensure host pip cache is world-readable"
        default n
index 8eb28aea03869d36b9c3a861752e5084d6505ea4..93a1c335ec18906191f9a5ba2453c552fa6d4c29 100644 (file)
@@ -11,7 +11,7 @@ include $(TOPDIR)/rules.mk
 include ../python3-version.mk
 
 PKG_NAME:=python3
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 PKG_VERSION:=$(PYTHON3_VERSION).$(PYTHON3_VERSION_MICRO)
 
 PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz
@@ -41,10 +41,9 @@ HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/Python-$(PKG_VERSION)
 
 PKG_CONFIG_DEPENDS:= \
        CONFIG_PACKAGE_python3-pkg-resources \
-       CONFIG_PACKAGE_python3-setuptools CONFIG_PACKAGE_python3-pip \
-       CONFIG_PYTHON3_BLUETOOTH_SUPPORT
+       CONFIG_PACKAGE_python3-setuptools CONFIG_PACKAGE_python3-pip
 
-PKG_BUILD_DEPENDS:=python3/host
+PKG_BUILD_DEPENDS:=bluez python3/host
 HOST_BUILD_DEPENDS:=bzip2/host expat/host libffi/host
 
 include $(INCLUDE_DIR)/host-build.mk
@@ -92,7 +91,7 @@ endef
 define Package/python3-light
 $(call Package/python3/Default)
   TITLE:=Python $(PYTHON3_VERSION) light installation
-  DEPENDS:=+python3-base +libffi +libbz2 +PYTHON3_BLUETOOTH_SUPPORT:bluez-libs +libuuid
+  DEPENDS:=+python3-base +libffi +libbz2 +libuuid
 endef
 
 define Package/python3-light/config
@@ -149,10 +148,6 @@ EXTRA_LDFLAGS+= \
        -L$(PKG_BUILD_DIR) \
        -L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib
 
-DISABLE_BLUETOOTH:= \
-       ac_cv_header_bluetooth_bluetooth_h=no \
-       ac_cv_header_bluetooth_h=no
-
 CONFIGURE_ARGS+= \
        --enable-optimizations \
        --enable-shared \
@@ -163,8 +158,7 @@ CONFIGURE_ARGS+= \
        $(if $(CONFIG_IPV6),--enable-ipv6) \
        $(if $(findstring mips,$(CONFIG_ARCH)),,--with-lto) \
        CONFIG_SITE="$(PKG_BUILD_DIR)/config.site" \
-       OPT="$(TARGET_CFLAGS)" \
-       $(if $(CONFIG_PYTHON3_BLUETOOTH_SUPPORT),,$(DISABLE_BLUETOOTH))
+       OPT="$(TARGET_CFLAGS)"
 
 define Build/Prepare
        $(call Build/Prepare/Default)
git clone https://git.99rst.org/PROJECT