nixpkgs-suyu/pkgs/development/python-modules/mido/default.nix
Zhong Jianxin ba7b2c8e25 mido: Reduce dependances
According to [mido document][1], python-rtmidi is the default
recommended backend, the other backends are optional, and don't have all
features.

Remove pygame and rtmidi-python will reduce closure size from 930M to
87M, without losing functionality.

I've check nixpkgs, no other package use specific mido backends. Even if
they do need one, they can and should add the specific backend to their
own buildInputs/propagatedBuildInputs, as mido dynamically load these
python libraries, it will work as expected.

For reference, [ArchLinux][2] and [Debian][3] both make some backends
optional.

[1]: https://mido.readthedocs.io/en/latest/backends/index.html
[2]: https://aur.archlinux.org/packages/python-mido
[3]: https://packages.debian.org/buster/python3-mido
2022-02-23 11:04:38 +08:00

45 lines
829 B
Nix

{ stdenv
, lib
, buildPythonPackage
, fetchPypi
, substituteAll
, portmidi
, python-rtmidi
, pytestCheckHook
}:
buildPythonPackage rec {
pname = "mido";
version = "1.2.10";
src = fetchPypi {
inherit pname version;
sha256 = "17b38a8e4594497b850ec6e78b848eac3661706bfc49d484a36d91335a373499";
};
patches = [
(substituteAll {
src = ./libportmidi-cdll.patch;
libportmidi = "${portmidi.out}/lib/libportmidi${stdenv.targetPlatform.extensions.sharedLibrary}";
})
];
propagatedBuildInputs = [
python-rtmidi
];
checkInputs = [
pytestCheckHook
];
pythonImportsCheck = [
"mido"
];
meta = with lib; {
description = "MIDI Objects for Python";
homepage = "https://mido.readthedocs.io";
license = licenses.mit;
maintainers = with maintainers; [ ];
};
}