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>
This commit is contained in:
aszlig 2016-12-19 10:47:33 +01:00
parent a7d425758a
commit 0409ce2330
No known key found for this signature in database
GPG key ID: 1DE8E48E57DB5436

View file

@ -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}";