1{
2 stdenv,
3 lib,
4 buildPythonPackage,
5 fetchPypi,
6 substituteAll,
7
8 # build-system
9 setuptools,
10 setuptools-scm,
11 pythonRelaxDepsHook,
12
13 # dependencies
14 packaging,
15
16 # native dependencies
17 portmidi,
18
19 # optional-dependencies
20 pygame,
21 python-rtmidi,
22 rtmidi-python,
23
24 # tests
25 pytestCheckHook,
26 pythonOlder,
27
28}:
29
30buildPythonPackage rec {
31 pname = "mido";
32 version = "1.3.2";
33 pyproject = true;
34
35 disabled = pythonOlder "3.7";
36
37 src = fetchPypi {
38 inherit pname version;
39 hash = "sha256-Ouootu1zD3N9WxLaNXjevp3FAFj6Nw/pzt7ZGJtnw0g=";
40 };
41
42 patches = [
43 (substituteAll {
44 src = ./libportmidi-cdll.patch;
45 libportmidi = "${portmidi.out}/lib/libportmidi${stdenv.hostPlatform.extensions.sharedLibrary}";
46 })
47 ];
48
49 build-system = [
50 setuptools
51 setuptools-scm
52 pythonRelaxDepsHook
53 ];
54
55 pythonRelaxDeps = [ "packaging" ];
56
57 dependencies = [ packaging ];
58
59 optional-dependencies = {
60 ports-pygame = [ pygame ];
61 ports-rtmidi = [ python-rtmidi ];
62 ports-rtmidi-python = [ rtmidi-python ];
63 };
64
65 nativeCheckInputs = [ pytestCheckHook ];
66
67 pythonImportsCheck = [ "mido" ];
68
69 meta = with lib; {
70 description = "MIDI Objects for Python";
71 homepage = "https://mido.readthedocs.io";
72 changelog = "https://github.com/mido/mido/releases/tag/${version}";
73 license = licenses.mit;
74 maintainers = with maintainers; [ ];
75 };
76}