File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 1212
1313import os as _os
1414import sys as _sys
15+ from platform import machine as _machine
1516from os import SEEK_SET , SEEK_CUR , SEEK_END
1617from ctypes .util import find_library as _find_library
1718from _soundfile import ffi as _ffi
159160 while not _os .path .isdir (_path ):
160161 _path = _os .path .abspath (_os .path .join (_path , '..' ))
161162
162- _snd = _ffi .dlopen (_os .path .join (
163- _path , '_soundfile_data' , _libname ))
163+ # Homebrew on Apple M1 uses a `/opt/homebrew/lib` instead of
164+ # `/usr/local/lib`. We are making sure we pick that up.
165+ if _sys .platform == 'darwin' and _machine () == 'arm64' :
166+ _hbrew_path = '/opt/homebrew/lib/' if _os .path .isdir ('/opt/homebrew/lib/' ) \
167+ else '/usr/local/lib/'
168+ _snd = _ffi .dlopen (_os .path .join (
169+ _hbrew_path , _libname ))
170+ else :
171+ _snd = _ffi .dlopen (_os .path .join (
172+ _path , '_soundfile_data' , _libname ))
164173
165174__libsndfile_version__ = _ffi .string (_snd .sf_version_string ()).decode ('utf-8' , 'replace' )
166175if __libsndfile_version__ .startswith ('libsndfile-' ):
You can’t perform that action at this time.
0 commit comments