Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 19.09 45 lines 1.2 kB view raw
1{ stdenv 2, buildPythonPackage 3, fetchPypi 4, nose 5, pillow 6, pkgs 7}: 8 9buildPythonPackage rec { 10 pname = "pyinsane2"; 11 version = "2.0.13"; 12 13 src = fetchPypi { 14 inherit pname version; 15 sha256 = "0d519531d552e4512776225eb400a6a4a9bfc83a08918ec7fea19cb2fa7ec4ee"; 16 }; 17 18 # This is needed by setup.py regardless of whether tests are enabled. 19 buildInputs = [ nose ]; 20 propagatedBuildInputs = [ pillow ]; 21 22 postPatch = '' 23 # pyinsane2 forks itself, so we need to re-inject the PYTHONPATH. 24 sed -i -e '/os.putenv.*PYINSANE_DAEMON/ { 25 a \ os.putenv("PYTHONPATH", ":".join(sys.path)) 26 }' pyinsane2/sane/abstract_proc.py 27 28 sed -i -e 's,"libsane.so.1","${pkgs.sane-backends}/lib/libsane.so",' \ 29 pyinsane2/sane/rawapi.py 30 ''; 31 32 # Tests require a scanner to be physically connected, so let's just do a 33 # quick check whether initialization works. 34 checkPhase = '' 35 python -c 'import pyinsane2; pyinsane2.init()' 36 ''; 37 38 meta = with stdenv.lib; { 39 homepage = "https://github.com/jflesch/pyinsane"; 40 description = "Access and use image scanners"; 41 license = licenses.gpl3Plus; 42 platforms = platforms.linux; 43 }; 44 45}