pythonPackages.pyinsane2: refactor move to python-modules

This commit is contained in:
Chris Ostrouchov 2018-10-26 09:55:39 -04:00 committed by Frederik Rietdijk
parent 73d1178084
commit 96c277b340
2 changed files with 46 additions and 37 deletions

View File

@ -0,0 +1,45 @@
{ stdenv
, buildPythonPackage
, fetchPypi
, nose
, pillow
, pkgs
}:
buildPythonPackage rec {
pname = "pyinsane2";
version = "2.0.10";
src = fetchPypi {
inherit pname version;
sha256 = "00d1wqb3w9bn1rxb2dwmdqbar2lr96izq855l5vzprc17dkgip3j";
};
# This is needed by setup.py regardless of whether tests are enabled.
buildInputs = [ nose ];
propagatedBuildInputs = [ pillow ];
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))
}' pyinsane2/sane/abstract_proc.py
sed -i -e 's,"libsane.so.1","${pkgs.sane-backends}/lib/libsane.so",' \
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()'
'';
meta = with stdenv.lib; {
homepage = "https://github.com/jflesch/pyinsane";
description = "Access and use image scanners";
license = licenses.gpl3Plus;
platforms = platforms.linux;
};
}

View File

@ -3370,43 +3370,7 @@ in {
pyinotify = callPackage ../development/python-modules/pyinotify { };
pyinsane2 = buildPythonPackage rec {
name = "pyinsane2-${version}";
version = "2.0.10";
src = pkgs.fetchurl {
url = "mirror://pypi/p/pyinsane2/${name}.tar.gz";
sha256 = "00d1wqb3w9bn1rxb2dwmdqbar2lr96izq855l5vzprc17dkgip3j";
};
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))
}' pyinsane2/sane/abstract_proc.py
sed -i -e 's,"libsane.so.1","${pkgs.sane-backends}/lib/libsane.so",' \
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;
};
};
pyinsane2 = callPackage ../development/python-modules/pyinsane2 { };
pyjwt = callPackage ../development/python-modules/pyjwt { };