at master 1.6 kB view raw
1{ 2 lib, 3 stdenv, 4 libsigrok, 5 toPythonModule, 6 python, 7 autoreconfHook, 8 pythonImportsCheckHook, 9 pythonCatchConflictsHook, 10 swig, 11 setuptools, 12 numpy, 13 pygobject3, 14}: 15 16# build libsigrok plus its Python bindings. Unfortunately it does not appear 17# to be possible to build them separately, at least not easily. 18toPythonModule ( 19 (libsigrok.override { python3 = python; }).overrideAttrs (orig: { 20 pname = "${python.libPrefix}-sigrok"; 21 22 patches = orig.patches or [ ] ++ [ 23 # Makes libsigrok install the bindings into site-packages properly (like 24 # we expect) instead of making a version-specific *.egg subdirectory. 25 ./python-install.patch 26 ]; 27 28 nativeBuildInputs = 29 orig.nativeBuildInputs or [ ] 30 ++ [ 31 autoreconfHook 32 setuptools 33 swig 34 numpy 35 ] 36 ++ lib.optionals (stdenv.hostPlatform == stdenv.buildPlatform) [ 37 pythonImportsCheckHook 38 pythonCatchConflictsHook 39 ]; 40 41 buildInputs = orig.buildInputs or [ ] ++ [ 42 pygobject3 # makes headers available the configure script checks for 43 ]; 44 45 propagatedBuildInputs = orig.propagatedBuildInputs or [ ] ++ [ 46 pygobject3 47 numpy 48 ]; 49 50 postInstall = '' 51 ${orig.postInstall or ""} 52 53 # for pythonImportsCheck 54 export PYTHONPATH="$out/${python.sitePackages}:$PYTHONPATH" 55 ''; 56 57 pythonImportsCheck = [ 58 "sigrok" 59 "sigrok.core" 60 ]; 61 62 meta = orig.meta // { 63 description = "Python bindings for libsigrok"; 64 maintainers = orig.meta.maintainers ++ [ lib.maintainers.sternenseemann ]; 65 }; 66 }) 67)