Search in default homebrew prefix on Apple Silicon #511
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On Apple Silicon, homebrew will by default (and, really, it's the only recommended way to use it) use the
/opt/homebrewprefix. The old/usr/localprefix is retained for the use of Intel/x86_64 homebrew.This means that libraries (e.g. LibUSB) installed through homebrew on Apple Silicon will end up in
/opt/homebrew/lib/. But that location isn't one of the search paths checked byctypes.util.find_library(which is what we use if no customfind_libraryis supplied by the caller). Homebrew patches the Python interpreters they distribute, but other/stock interpreters don't know about this additional location for libraries.As this is a frequent enough issue, let's check for that additional (and hardcoded) prefix if nothing is found in the normal search paths.
Note that, just like
ctypes.util.find_library, we currently don't take into account the architecture: the first library found with a suitable name is used, even if it doesn't match the architecture of the Python interpreter in use.This PR also includes basic maintenance (including bumping the minimum supported Python version), mostly just so it can run in our CI.
Related: #355
Related: #361
Related: #509
Related: liquidctl/liquidctl#637 (comment)