Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@jonasmalacofilho
Copy link
Member

On Apple Silicon, homebrew will by default (and, really, it's the only recommended way to use it) use the /opt/homebrew prefix. The old /usr/local prefix 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 by ctypes.util.find_library (which is what we use if no custom find_library is 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)

@jonasmalacofilho jonasmalacofilho merged commit 4a433a5 into pyusb:master Apr 30, 2024
@clach04
Copy link
Contributor

clach04 commented Jun 20, 2024

My 2 cents, mac changes look fine from a quick skim (I'm not a mac user, excellent explanation on why this is needed 👍 ).

PR also changes minimum Python requirements but that's not mentioned in the PR - seems out of scope for fixing mac support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.