depot/third_party/nixpkgs/pkgs/development/python-modules/miniaudio/default.nix
Default email 87f9c27ba9 Project import generated by Copybara.
GitOrigin-RevId: fe2ecaf706a5907b5e54d979fbde4924d84b65fc
2023-04-12 14:48:02 +02:00

57 lines
1.2 KiB
Nix

{ lib
, stdenv
, buildPythonPackage
, pythonOlder
, fetchFromGitHub
, miniaudio
, cffi
, pytestCheckHook
, AudioToolbox
, CoreAudio
}:
buildPythonPackage rec {
pname = "miniaudio";
version = "1.56";
disabled = pythonOlder "3.6";
format = "setuptools";
src = fetchFromGitHub {
owner = "irmen";
repo = "pyminiaudio";
rev = "refs/tags/v${version}";
hash = "sha256-vNh9BupU6T+Gfa8fdt8r3/vqtTtfVDyrxM9GkFUcDcI=";
};
postPatch = ''
rm -r miniaudio
ln -s ${miniaudio} miniaudio
substituteInPlace build_ffi_module.py \
--replace "miniaudio/stb_vorbis.c" "miniaudio/extras/stb_vorbis.c";
substituteInPlace miniaudio.c \
--replace "miniaudio/stb_vorbis.c" "miniaudio/extras/stb_vorbis.c";
'';
buildInputs = lib.optionals stdenv.isDarwin [
AudioToolbox
CoreAudio
];
propagatedNativeBuildInputs = [ cffi ];
propagatedBuildInputs = [ cffi ];
nativeCheckInputs = [
pytestCheckHook
];
pythonImportsCheck = [ "miniaudio" ];
meta = with lib; {
description = "Python bindings for the miniaudio library and its decoders";
homepage = "https://github.com/irmen/pyminiaudio";
license = licenses.mit;
maintainers = with maintainers; [ dotlambda ];
};
}