Merge pull request #313995 from matthiasdotsh/python3Packages.soundcard

python312Packages.soundcard init at 0.4.3
This commit is contained in:
Jacek Galowicz 2024-08-03 20:44:35 +02:00 committed by GitHub
commit 82acc93ba6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 105 additions and 0 deletions

View File

@ -12705,6 +12705,12 @@
githubId = 427866;
name = "Matthias Beyer";
};
matthiasdotsh = {
email = "git@matthias.sh";
name = "Matthias";
github = "matthiasdotsh";
githubId = 142118899;
};
matthiasq = {
email = "matthias.queitsch@mailbox.org";
github = "matthias-Q";

View File

@ -0,0 +1,50 @@
{
buildPythonPackage,
cffi,
fetchPypi,
lib,
libpulseaudio,
numpy,
setuptools,
testers,
}:
let
version = "0.4.3";
in
buildPythonPackage {
inherit version;
pname = "soundcard";
pyproject = true;
src = fetchPypi {
inherit version;
pname = "SoundCard";
hash = "sha256-QQg1UUuhCAmAPLmIfUJw85K1nq82WRW7lFFq8/ix0Dc=";
};
patchPhase = ''
substituteInPlace soundcard/pulseaudio.py \
--replace "'pulse'" "'${libpulseaudio}/lib/libpulse.so'"
'';
build-system = [ setuptools ];
dependencies = [
cffi
numpy
];
# doesn't work because there are not many soundcards in the
# sandbox. See VM-test
# pythonImportsCheck = [ "soundcard" ];
passthru.tests.vm-with-soundcard = testers.runNixOSTest ./test.nix;
meta = {
description = "Pure-Python Real-Time Audio Library";
homepage = "https://github.com/bastibe/SoundCard";
changelog = "https://github.com/bastibe/SoundCard/blob/${version}/README.rst#changelog";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ matthiasdotsh ];
};
}

View File

@ -0,0 +1,47 @@
{
name = "Python Soundcard Library Test";
nodes.machine =
{ pkgs, ... }:
{
environment.systemPackages = [ (pkgs.python3.withPackages (ps: [ ps.soundcard ])) ];
hardware.pulseaudio.enable = true;
hardware.pulseaudio.systemWide = true;
virtualisation.qemu.options = [
"-device virtio-sound-pci,audiodev=my_audiodev"
"-audiodev wav,id=my_audiodev"
];
};
interactive.nodes.machine =
{ ... }:
{
services.openssh.enable = true;
services.openssh.settings.PermitRootLogin = "yes";
users.extraUsers.root.initialPassword = "";
users.extraUsers.root.hashedPassword = null;
users.extraUsers.root.hashedPasswordFile = null;
users.extraUsers.root.initialHashedPassword = null;
virtualisation.forwardPorts = [
{
from = "host";
host.port = 2222;
guest.port = 22;
}
];
};
testScript =
let
script = builtins.toFile "import.py" ''
import soundcard
'';
in
''
start_all()
machine.wait_for_unit("multi-user.target")
machine.succeed("python ${script}")
'';
}

View File

@ -14566,6 +14566,8 @@ self: super: with self; {
sortedcontainers = callPackage ../development/python-modules/sortedcontainers { };
soundcard = callPackage ../development/python-modules/soundcard { };
soundcloud-v2 = callPackage ../development/python-modules/soundcloud-v2 { };
sounddevice = callPackage ../development/python-modules/sounddevice { };