python,python3: define config option for bluetooth support 5197/head
authorAlexandru Ardelean <ardeleanalex@gmail.com>
Thu, 30 Nov 2017 14:44:48 +0000 (16:44 +0200)
committerAlexandru Ardelean <ardeleanalex@gmail.com>
Sun, 10 Dec 2017 17:49:23 +0000 (19:49 +0200)
It was reported via
https://github.com/openwrt/packages/pull/5122#issuecomment-347395472
that if bluez-libs is selected as an installable package,
then the error below will show up:
```
 * satisfy_dependencies_for: Cannot satisfy the following dependencies for python-light:
 * bluez-libs *
 * opkg_install_cmd: Cannot install package python-light.
```

This looks like a limitation in the design of package deps,
and maybe a misuse of conditional deps (i.e. PACKAGE_bluez-libs:bluez-libs).

So, to fix this, an idea we're adding an extra symbol
that enfoces installation of bluez-libs if selected.

We also need to add a way to disable bluetooth build
if PYTHON(3)_BLUETOOTH_SUPPORT is de-selected.
Otherwise, bluetooth is installed and the socket
module is broken due to linker errors.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
lang/python/python/Config-python-light.in [new file with mode: 0644]
lang/python/python/Makefile
lang/python/python3/Config-python3-light.in [new file with mode: 0644]
lang/python/python3/Makefile

diff --git a/lang/python/python/Config-python-light.in b/lang/python/python/Config-python-light.in
new file mode 100644 (file)
index 0000000..c6c2041
--- /dev/null
@@ -0,0 +1,7 @@
+menu "Configuration"
+
+config PYTHON_BLUETOOTH_SUPPORT
+       bool "Enable Bluetooth support"
+       default n
+
+endmenu
index c5a22419db0cc45746e0d291775c3bcd9a372cf3..0e0ffc25c61cffb5533433145bb301bb61256f4f 100644 (file)
@@ -14,7 +14,7 @@ PKG_NAME:=python
 PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO)
 # XXX: reset PKG_RELEASE to 1 only if Python's pip & setuptools versions have also bumped;
 #      otherwise, keep bumping PKG_RELEASE
-PKG_RELEASE:=4
+PKG_RELEASE:=5
 
 PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=https://www.python.org/ftp/python/$(PKG_VERSION)
@@ -39,9 +39,9 @@ HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/Python-$(PKG_VERSION)
 
 PKG_CONFIG_DEPENDS:= \
        CONFIG_PACKAGE_python-setuptools CONFIG_PACKAGE_python-pip \
-       CONFIG_PACKAGE_bluez-libs
+       CONFIG_PYTHON_BLUETOOTH_SUPPORT
 
-PKG_BUILD_DEPENDS:=python/host PACKAGE_bluez-libs:bluez-libs
+PKG_BUILD_DEPENDS:=python/host
 HOST_BUILD_DEPENDS:=bzip2/host expat/host
 
 include $(INCLUDE_DIR)/host-build.mk
@@ -79,7 +79,11 @@ endef
 define Package/python-light
 $(call Package/python/Default)
   TITLE:=Python $(PYTHON_VERSION) light installation
-  DEPENDS:=+python-base +libffi +libbz2 +PACKAGE_bluez-libs:bluez-libs
+  DEPENDS:=+python-base +libffi +libbz2 +PYTHON_BLUETOOTH_SUPPORT:bluez-libs
+endef
+
+define Package/python-light/config
+  source "$(SOURCE)/Config-python-light.in"
 endef
 
 define Package/python-light/description
@@ -140,6 +144,10 @@ PYTHON_FOR_BUILD:= \
        _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata \
        $(HOST_PYTHON_BIN)
 
+DISABLE_BLUETOOTH:= \
+    ac_cv_header_bluetooth_bluetooth_h=no \
+    ac_cv_header_bluetooth_h=no
+
 CONFIGURE_ARGS+= \
        --sysconfdir=/etc \
        --enable-shared \
@@ -148,6 +156,7 @@ CONFIGURE_ARGS+= \
        --with-system-ffi \
        --with-ensurepip=no \
        --without-pymalloc \
+       $(if $(CONFIG_PYTHON_BLUETOOTH_SUPPORT),,$(DISABLE_BLUETOOTH)) \
        PYTHON_FOR_BUILD="$(PYTHON_FOR_BUILD)" \
        $(ENABLE_IPV6) \
        CONFIG_SITE="$(PKG_BUILD_DIR)/config.site" \
diff --git a/lang/python/python3/Config-python3-light.in b/lang/python/python3/Config-python3-light.in
new file mode 100644 (file)
index 0000000..eb22262
--- /dev/null
@@ -0,0 +1,7 @@
+menu "Configuration"
+
+config PYTHON3_BLUETOOTH_SUPPORT
+       bool "Enable Bluetooth support"
+       default n
+
+endmenu
index 38e55ba542f3cc3ca9eab72a5cd45306c4f6abc1..924fec58f050338ffd95eed9c0ee6187a04b6c61 100644 (file)
@@ -16,7 +16,7 @@ PYTHON_VERSION_MICRO:=$(PYTHON3_VERSION_MICRO)
 PKG_NAME:=python3
 # XXX: reset PKG_RELEASE to 1 only if Python's pip & setuptools versions have also bumped;
 #      otherwise, keep bumping PKG_RELEASE
-PKG_RELEASE:=10
+PKG_RELEASE:=11
 PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO)
 
 PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz
@@ -42,10 +42,9 @@ HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/Python-$(PKG_VERSION)
 
 PKG_CONFIG_DEPENDS:= \
        CONFIG_PACKAGE_python3-setuptools CONFIG_PACKAGE_python3-pip \
-       CONFIG_PACKAGE_bluez-libs
+       CONFIG_PYTHON3_BLUETOOTH_SUPPORT
 
-
-PKG_BUILD_DEPENDS:=python3/host PACKAGE_bluez-libs:bluez-libs
+PKG_BUILD_DEPENDS:=python3/host
 HOST_BUILD_DEPENDS:=bzip2/host expat/host libffi/host
 
 include $(INCLUDE_DIR)/host-build.mk
@@ -83,7 +82,11 @@ endef
 define Package/python3-light
 $(call Package/python3/Default)
   TITLE:=Python $(PYTHON_VERSION) light installation
-  DEPENDS:=+python3-base +libffi +libbz2 +PACKAGE_bluez-libs:bluez-libs
+  DEPENDS:=+python3-base +libffi +libbz2 +PYTHON3_BLUETOOTH_SUPPORT:bluez-libs
+endef
+
+define Package/python3-light/config
+  source "$(SOURCE)/Config-python3-light.in"
 endef
 
 define Package/python3-light/description
@@ -145,6 +148,10 @@ PYTHON_FOR_BUILD:= \
        _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata \
        $(HOST_PYTHON3_BIN)
 
+DISABLE_BLUETOOTH:= \
+       ac_cv_header_bluetooth_bluetooth_h=no \
+       ac_cv_header_bluetooth_h=no
+
 CONFIGURE_ARGS+= \
        --sysconfdir=/etc \
        --enable-shared \
@@ -153,6 +160,7 @@ CONFIGURE_ARGS+= \
        --with-system-ffi \
        --with-ensurepip=no \
        --without-pymalloc \
+       $(if $(CONFIG_PYTHON3_BLUETOOTH_SUPPORT),,$(DISABLE_BLUETOOTH)) \
        PYTHON_FOR_BUILD="$(PYTHON_FOR_BUILD)" \
        $(ENABLE_IPV6) \
        CONFIG_SITE="$(PKG_BUILD_DIR)/config.site" \