1{ lib
2, buildPythonPackage
3, fetchPypi
4, setuptools
5, wheel
6, numpy
7, fluidsynth
8, stdenv
9, fetchpatch
10}:
11
12buildPythonPackage rec {
13 pname = "pyfluidsynth";
14 version = "1.3.2";
15 format = "pyproject";
16
17 src = fetchPypi {
18 pname = "pyFluidSynth";
19 inherit version;
20 hash = "sha256-+i5oOXV4UG6z4rQGuguOP0mHo7V7fJZZRwOnJKB1VfQ=";
21 };
22
23 patches = [
24 # fixes error: Unknown integer parameter 'synth.sample-rate'
25 # https://github.com/nwhitehead/pyfluidsynth/pull/44
26 (fetchpatch {
27 name = "add-fluid-synth-get-status-and-fix-some-typing-bugs.patch";
28 url = "https://github.com/nwhitehead/pyfluidsynth/commit/1b31ca6ab00930dbb515c4cc00bb31a65578b7c0.patch";
29 hash = "sha256-ZCqy7aIv5iAAJrWOD7e538xltj11gy5fakIXnAbUsu8=";
30 })
31 ];
32
33 nativeBuildInputs = [
34 setuptools
35 wheel
36 ];
37
38 propagatedBuildInputs = [
39 numpy
40 ];
41
42 pythonImportsCheck = [ "fluidsynth" ];
43
44 postPatch = ''
45 sed -Ezi fluidsynth.py -e \
46 's|lib = .*\\\n[^\n]*|lib = "${lib.getLib fluidsynth}/lib/libfluidsynth${stdenv.hostPlatform.extensions.sharedLibrary}"|'
47 '';
48
49 meta = with lib; {
50 description = "Python bindings for FluidSynth, a MIDI synthesizer that uses SoundFont instruments";
51 homepage = "https://github.com/nwhitehead/pyfluidsynth";
52 license = licenses.lgpl21Plus;
53 maintainers = with maintainers; [ figsoda ];
54 };
55}