diff options
author | aszlig <aszlig@redmoonstudios.org> | 2016-12-19 10:47:33 +0100 |
---|---|---|
committer | aszlig <aszlig@redmoonstudios.org> | 2016-12-19 22:25:31 +0100 |
commit | 0409ce23303a0b194a10c1cb81971a03066d7770 (patch) | |
tree | ec4e0866c9b44182720d5c979611aa20b42ead91 | |
parent | a7d425758a1d235615f17fae5c06cb1f87a4b53c (diff) | |
download | nixlib-0409ce23303a0b194a10c1cb81971a03066d7770.tar nixlib-0409ce23303a0b194a10c1cb81971a03066d7770.tar.gz nixlib-0409ce23303a0b194a10c1cb81971a03066d7770.tar.bz2 nixlib-0409ce23303a0b194a10c1cb81971a03066d7770.tar.lz nixlib-0409ce23303a0b194a10c1cb81971a03066d7770.tar.xz nixlib-0409ce23303a0b194a10c1cb81971a03066d7770.tar.zst nixlib-0409ce23303a0b194a10c1cb81971a03066d7770.zip |
python/pyinsane2: init at 2.0.9
The tests require a scanner to be physically attached. Quote from the upstream README: > Tests require at least one scanner with a flatbed and an ADF > (Automatic Document Feeder). > > If possible, they should be run with at least 2 scanners connected. > The first that appear in "scanimage -L" must be the one with the ADF. > > For reference, my current setup is: > > - HP Officejet 4620 (Flatbed + ADF) > - HP Deskjet 2050 J510 series (Flatbed) So we disable the tests even though it might be theoretically possible to use qemu and an emulated scanner. Instead of the upstream tests we just do a quick check whether initialization of the library succeeds. Other than that the library uses ctypes.cdll to dlopen() the libsane shared library, so we need to patch in the right store path. Tested by building against Python 2.7, 3.3, 3.4, 3.5 and 3.6. Signed-off-by: aszlig <aszlig@redmoonstudios.org>
-rw-r--r-- | pkgs/top-level/python-packages.nix | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index f4a425b26733..92554e654712 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -20422,6 +20422,44 @@ in { }; }; + pyinsane2 = buildPythonPackage rec { + name = "pyinsane2-${version}"; + version = "2.0.9"; + + src = pkgs.fetchurl { + url = "mirror://pypi/p/pyinsane2/${name}.tar.gz"; + sha256 = "1g4a1zhrrs7smmnsm7x8j5lvsz0r6rr2jgjykc9c1jlscz3yr747"; + }; + + postPatch = '' + # pyinsane2 forks itself, so we need to re-inject the PYTHONPATH. + sed -i -e '/os.putenv.*PYINSANE_DAEMON/ { + a \ os.putenv("PYTHONPATH", ":".join(sys.path)) + }' src/pyinsane2/sane/abstract_proc.py + + sed -i -e 's,"libsane.so.1","${pkgs.sane-backends}/lib/libsane.so",' \ + src/pyinsane2/sane/rawapi.py + ''; + + # Tests require a scanner to be physically connected, so let's just do a + # quick check whether initialization works. + checkPhase = '' + python -c 'import pyinsane2; pyinsane2.init()' + ''; + + # This is needed by setup.py regardless of whether tests are enabled. + buildInputs = [ self.nose ]; + + propagatedBuildInputs = [ self.pillow ]; + + meta = { + homepage = "https://github.com/jflesch/pyinsane"; + description = "Access and use image scanners"; + license = licenses.gpl3Plus; + platforms = platforms.linux; + }; + }; + pyjwt = buildPythonPackage rec { version = "1.4.2"; name = "pyjwt-${version}"; |