Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dpkg-query not found on all Linux systems #51

Closed
matthewhague opened this issue Nov 27, 2018 · 5 comments
Closed

dpkg-query not found on all Linux systems #51

matthewhague opened this issue Nov 27, 2018 · 5 comments

Comments

@matthewhague
Copy link

matthewhague commented Nov 27, 2018

  • bleak version: 0.2.2
  • Python version: 3.7.1
  • Operating System: Arch Linux

Description

The __init__ function fails with "no such file or directory 'dpkg-query'" when using the module. Dpkg is not used on Arch Linux, so i would not expect this check to pass.

What I Did

Started the Python interpreter and attempted
import bleak

Many thanks for the nice looking library!

@hbldh
Copy link
Owner

hbldh commented Nov 28, 2018

Ah, of course. This was an oversight on my part; thank you for bringing it to my attention!

How would you propose to do this on Arch Linux? To use a call to pacman?
Or try to use bluetoothctl --version directly and try to parse that directly since the package is probably already installed? I do not remember why I chose not to do this in the first place, but I think I had a reason.

hbldh added a commit that referenced this issue Nov 28, 2018
Fixes issue #51.
@hbldh
Copy link
Owner

hbldh commented Nov 28, 2018

Made new release (0.2.3) to PyPI that I think will fix the issue, given that you actually have BlueZ installed on your Arch Linux.

@matthewhague
Copy link
Author

Cool, thanks! -- i'd already cheated a bit by commenting out the check. Otherwise it does exactly what i needed, with way less code that the other library i tried.

I had a look around to for a way to check the version in Python, but didn't find anything. With ctype.util.find_library("bluetooth") you can find the bluetooth library version, but i'm not sure that's what you want. If you're using bluez via dbus, i'd hope there is a way of querying the availability and version of services, but don't know enough about dbus to make progress in the time i have.

Using bluetoothctl is probably a reasonable solution. I'd add some kind of catch for when it's not available. Perhaps falling back on dpkg-query. If neither of those work, perhaps just a warning will do?

@matthewhague
Copy link
Author

matthewhague commented Nov 28, 2018

Looking at the names of the Bluez things you use, it looks like Bluez versions its interfaces. Perhaps you don't need to test for a specific Bluez version, and can just try opening the interfaces and taking a failure to mean it's not installed. If the interfaces open, then they should have a compatible interface.

@hbldh hbldh closed this as completed in 2409980 Nov 30, 2018
hbldh added a commit that referenced this issue Nov 30, 2018
Fixes #52 and #51.
@hbldh
Copy link
Owner

hbldh commented Nov 30, 2018

I will use bluetoothctl --version for the time being, and try to do the checking via DBUS in the future.
Version 0.2.3 was incorrect, but it is solved in 0.2.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants