All of lore.kernel.org
 help / color / mirror / Atom feed
* Question: Need advise with providing native Bluetooth sockets for Python
@ 2024-11-09 13:48 Guðni Már Gilbert
  2024-11-09 14:49 ` Guðni Már Gilbert
  0 siblings, 1 reply; 5+ messages in thread
From: Guðni Már Gilbert @ 2024-11-09 13:48 UTC (permalink / raw)
  To: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 1434 bytes --]

Hi everyone,

I am upgrading a project from Scarthgap to Styhead and am facing a problem again which I somewhat solved before though not properly. And now I want to fix it for good and hopefully have the solution upstream too.

The problem: I have a Python application which needs bluetooth.h header from BlueZ (https://github.com/bluez/bluez/tree/master/lib) at compile time. This is needed by Python's configure script (https://github.com/python/cpython/blob/6293d00e7201f3f28b1f4512e57dc4f03855cabd/configure#L10937) at such that the Python installation includes support for sockets like AF_BLUETOOTH and BTPROTO_RFCOMM.

Without this, a line like the following will simply fail: sock = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_STREAM, socket.BTPROTO_RFCOMM)

On Scarthgap I could do this by adding bbappend for Python with: DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez5', '', d)}". This however is prone to creating dependency loops.

To fix this properly, I need to somehow provide only the contents of this folder: https://github.com/bluez/bluez/tree/master/lib ( https://github.com/bluez/bluez/tree/master/lib ) to Python at build-time while not depending on building BlueZ package and its dependencies. To my knowledge there is no way to use the current BlueZ recipe to do this, though I may be wrong. I am curious how others would solve this problem. Is a new recipe the best way?

[-- Attachment #2: Type: text/html, Size: 1626 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question: Need advise with providing native Bluetooth sockets for Python
  2024-11-09 13:48 Question: Need advise with providing native Bluetooth sockets for Python Guðni Már Gilbert
@ 2024-11-09 14:49 ` Guðni Már Gilbert
  2024-11-09 17:09   ` Guðni Már Gilbert
  0 siblings, 1 reply; 5+ messages in thread
From: Guðni Már Gilbert @ 2024-11-09 14:49 UTC (permalink / raw)
  To: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 597 bytes --]

Hmm I found this in BlueZ README, it suggests creating a separate package. If no one is against that idea I will try to create it and submit a patch.

--enable-library
Enable installation of Bluetooth library
By default the Bluetooth library is no longer installed.
The user interfaces or command line utilities do not
require an installed Bluetooth library anymore. This
option is provided for legacy third party applications
that still depend on the library.
When the library installation is enabled, it is a good
idea to use a separate bluez-library or libbluetooth
package for it.

[-- Attachment #2: Type: text/html, Size: 967 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question: Need advise with providing native Bluetooth sockets for Python
  2024-11-09 14:49 ` Guðni Már Gilbert
@ 2024-11-09 17:09   ` Guðni Már Gilbert
  2024-11-11 13:13     ` [OE-core] " Ross Burton
  0 siblings, 1 reply; 5+ messages in thread
From: Guðni Már Gilbert @ 2024-11-09 17:09 UTC (permalink / raw)
  To: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 260 bytes --]

Adding this to bluez5 bbappend:

PACKAGECONFIG:class-native = ""
BBCLASSEXTEND = "native"

And to python3 bbappend:
DEPENDS:append:class-target = " ${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez5-native', '', d)}"

Seems to do the trick.

[-- Attachment #2: Type: text/html, Size: 377 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [OE-core] Question: Need advise with providing native Bluetooth sockets for Python
  2024-11-09 17:09   ` Guðni Már Gilbert
@ 2024-11-11 13:13     ` Ross Burton
  2024-11-11 17:36       ` Guðni Már Gilbert
  0 siblings, 1 reply; 5+ messages in thread
From: Ross Burton @ 2024-11-11 13:13 UTC (permalink / raw)
  To: gudni.m.g@gmail.com; +Cc: openembedded-core@lists.openembedded.org

On 9 Nov 2024, at 17:09, Guðni Már Gilbert via lists.openembedded.org <gudni.m.g=gmail.com@lists.openembedded.org> wrote:
> 
> Adding this to bluez5 bbappend:
>   PACKAGECONFIG:class-native = ""
> BBCLASSEXTEND = "native"
>   And to python3 bbappend:
> DEPENDS:append:class-target = " ${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez5-native', '', d)}"
>   Seems to do the trick.

Adding a PACKAGECONFIG for library that is on by default and then PACKAGECONFIG:class-native = “library” seems like a neat and self-documenting way of handling this.

Ross

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question: Need advise with providing native Bluetooth sockets for Python
  2024-11-11 13:13     ` [OE-core] " Ross Burton
@ 2024-11-11 17:36       ` Guðni Már Gilbert
  0 siblings, 0 replies; 5+ messages in thread
From: Guðni Már Gilbert @ 2024-11-11 17:36 UTC (permalink / raw)
  To: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 105 bytes --]

I've submitted a patch which builds without any issues on my end. I am testing on latest master branch.

[-- Attachment #2: Type: text/html, Size: 116 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-11-11 17:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-09 13:48 Question: Need advise with providing native Bluetooth sockets for Python Guðni Már Gilbert
2024-11-09 14:49 ` Guðni Már Gilbert
2024-11-09 17:09   ` Guðni Már Gilbert
2024-11-11 13:13     ` [OE-core] " Ross Burton
2024-11-11 17:36       ` Guðni Már Gilbert

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.