From c0c8dcd828921ef71074dc553fb955bc291fdbed Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Sun, 19 Apr 2020 16:40:30 +0200 Subject: pythonPackages.pulsectl: init at 20.4.3 --- .../python-modules/pulsectl/default.nix | 31 ++++++++++++++++++++++ .../python-modules/pulsectl/library-paths.patch | 22 +++++++++++++++ pkgs/top-level/python-packages.nix | 2 ++ 3 files changed, 55 insertions(+) create mode 100644 pkgs/development/python-modules/pulsectl/default.nix create mode 100644 pkgs/development/python-modules/pulsectl/library-paths.patch (limited to 'pkgs') diff --git a/pkgs/development/python-modules/pulsectl/default.nix b/pkgs/development/python-modules/pulsectl/default.nix new file mode 100644 index 000000000000..dec80abda151 --- /dev/null +++ b/pkgs/development/python-modules/pulsectl/default.nix @@ -0,0 +1,31 @@ +{ lib, buildPythonPackage, fetchPypi, libpulseaudio, glibc, substituteAll, stdenv, pulseaudio, python }: + +buildPythonPackage rec { + pname = "pulsectl"; + version = "20.4.3"; + + src = fetchPypi { + inherit pname version; + sha256 = "1m5fz740r4rk2i8qsnblsn16hai7givqxbx21swhpflan1yzvzzm"; + }; + + patches = [ + (substituteAll { + src = ./library-paths.patch; + libpulse = "${libpulseaudio.out}/lib/libpulse${stdenv.hostPlatform.extensions.sharedLibrary}"; + librt = "${glibc.out}/lib/librt${stdenv.hostPlatform.extensions.sharedLibrary}"; + }) + ]; + + checkInputs = [ pulseaudio ]; + checkPhase = '' + ${python.interpreter} -m unittest pulsectl.tests.all + ''; + + meta = with lib; { + description = "Python high-level interface and ctypes-based bindings for PulseAudio (libpulse)"; + homepage = "https://pypi.python.org/pypi/pulsectl/"; + license = licenses.mit; + maintainers = with maintainers; [ hexa ]; + }; +} diff --git a/pkgs/development/python-modules/pulsectl/library-paths.patch b/pkgs/development/python-modules/pulsectl/library-paths.patch new file mode 100644 index 000000000000..5840e515258d --- /dev/null +++ b/pkgs/development/python-modules/pulsectl/library-paths.patch @@ -0,0 +1,22 @@ +diff --git a/pulsectl/_pulsectl.py b/pulsectl/_pulsectl.py +index 4422ddf..3fb2f39 100644 +--- a/pulsectl/_pulsectl.py ++++ b/pulsectl/_pulsectl.py +@@ -31,7 +31,7 @@ else: + if not hasattr(mono_time, 'ts'): + class timespec(Structure): + _fields_ = [('tv_sec', c_long), ('tv_nsec', c_long)] +- librt = CDLL('librt.so.1', use_errno=True) ++ librt = CDLL('@librt@', use_errno=True) + mono_time.get = librt.clock_gettime + mono_time.get.argtypes = [c_int, POINTER(timespec)] + mono_time.ts = timespec +@@ -625,7 +625,7 @@ class LibPulse(object): + + + def __init__(self): +- p = CDLL(ctypes.util.find_library('libpulse') or 'libpulse.so.0') ++ p = CDLL('@libpulse@') + + self.funcs = dict() + for k, spec in self.func_defs.items(): diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index cb5cbb5375a7..0dc2f1ea1d93 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1063,6 +1063,8 @@ in { proglog = callPackage ../development/python-modules/proglog { }; + pulsectl = callPackage ../development/python-modules/pulsectl { }; + pure-python-adb-homeassistant = callPackage ../development/python-modules/pure-python-adb-homeassistant { }; purl = callPackage ../development/python-modules/purl { }; -- cgit 1.4.1