mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-02 15:41:48 +00:00
pythonpackages.sounddevice: 0.3.9 -> 0.3.11 and fix for portaudio library path (#43083)
This commit is contained in:
parent
059f5fd8a8
commit
9291a3c0cf
@ -4,15 +4,16 @@
|
||||
, cffi
|
||||
, numpy
|
||||
, portaudio
|
||||
, substituteAll
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "sounddevice";
|
||||
version = "0.3.9";
|
||||
version = "0.3.11";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "1c9e833f8c8ccc67c0291c3448b29e9acc548fe56d15ee6f7fdd7037e00319f8";
|
||||
sha256 = "0pfcbgbl77nggchxb2i5rb78m7hpgn65aqpz99yfx1fgfbmy9yg1";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = [ cffi numpy portaudio ];
|
||||
@ -20,9 +21,12 @@ buildPythonPackage rec {
|
||||
# No tests included nor upstream available.
|
||||
doCheck = false;
|
||||
|
||||
prePatch = ''
|
||||
substituteInPlace src/sounddevice.py --replace "'portaudio'" "'${portaudio}/lib/libportaudio.so.2'"
|
||||
'';
|
||||
patches = [
|
||||
(substituteAll {
|
||||
src = ./fix-portaudio-library-path.patch;
|
||||
portaudio = "${portaudio}/lib/libportaudio.so.2";
|
||||
})
|
||||
];
|
||||
|
||||
meta = {
|
||||
description = "Play and Record Sound with Python";
|
||||
|
@ -0,0 +1,34 @@
|
||||
diff --git a/sounddevice.py b/sounddevice.py
|
||||
index f03476c..5745b6e 100644
|
||||
--- a/sounddevice.py
|
||||
+++ b/sounddevice.py
|
||||
@@ -58,28 +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
|
||||
- ):
|
||||
- _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':
|
||||
- _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,
|
Loading…
Reference in New Issue
Block a user