nixpkgs/pkgs/development/python-modules/sounddevice/fix-portaudio-library-path.patch
2024-10-28 13:15:16 +01:00

39 lines
1.3 KiB
Diff

diff --git a/sounddevice.py b/sounddevice.py
index 0974289..2d56c28 100644
--- a/sounddevice.py
+++ b/sounddevice.py
@@ -58,32 +58,7 @@ from ctypes.util import find_library as _find_library
from _sounddevice import ffi as _ffi
-try:
- for _libname in (
- 'portaudio', # Default name on POSIX systems
- 'bin\\libportaudio-2.dll', # DLL from conda-forge
- 'lib/libportaudio.dylib', # dylib from anaconda
- ):
- _libname = _find_library(_libname)
- if _libname is not None:
- break
- else:
- raise OSError('PortAudio library not found')
- _lib = _ffi.dlopen(_libname)
-except OSError:
- if _platform.system() == 'Darwin':
- _libname = 'libportaudio.dylib'
- elif _platform.system() == 'Windows':
- if 'SD_ENABLE_ASIO' in _os.environ:
- _libname = 'libportaudio' + _platform.architecture()[0] + '-asio.dll'
- else:
- _libname = 'libportaudio' + _platform.architecture()[0] + '.dll'
- else:
- raise
- import _sounddevice_data
- _libname = _os.path.join(
- next(iter(_sounddevice_data.__path__)), 'portaudio-binaries', _libname)
- _lib = _ffi.dlopen(_libname)
+_lib = _ffi.dlopen('@portaudio@')
_sampleformats = {
'float32': _lib.paFloat32,