Commit 51dd6751 authored by Ihar Hrachyshka's avatar Ihar Hrachyshka
Browse files

python312Packages.pyssim: 0.6 -> 0.7



Also include a patch to deal with the latest scipy.

Signed-off-by: default avatarIhar Hrachyshka <ihar.hrachyshka@gmail.com>
parent cb7b4340
Loading
Loading
Loading
Loading
+12 −14
Original line number Diff line number Diff line
@@ -5,18 +5,20 @@
  numpy,
  scipy,
  pillow,
  pywavelets,
  fetchpatch,
}:

buildPythonPackage rec {
  pname = "pyssim";
  version = "0.6";
  version = "0.7";
  format = "setuptools";

  propagatedBuildInputs = [
  dependencies = [
    numpy
    scipy
    pillow
    pywavelets
  ];

  # PyPI tarball doesn't contain test images so let's use GitHub
@@ -24,22 +26,18 @@ buildPythonPackage rec {
    owner = "jterrace";
    repo = pname;
    rev = "v${version}";
    sha256 = "sha256-VvxQTvDTDms6Ccyclbf9P0HEQksl5atPPzHuH8yXTmc=";
    sha256 = "sha256-LDNIugQeRqNsAZ5ZxS/NxHokEAwefpfRutTRpR0IcXk=";
  };

  patches = [
    # "Replace Image.ANTIALIAS with Image.LANCZOS"
    # Image.ANTIALIAS has been removed in Pillow 10.0.0,
    # the version currently in nixpkgs,
    # and Image.LANCZOS is a drop-in since Pillow 2.7.0.
    # https://github.com/jterrace/pyssim/pull/45
    # "Use PyWavelets for continuous wavelet transform"; signal.cwt was removed and broke the build
    (fetchpatch {
      url = "https://github.com/jterrace/pyssim/commit/db4296c12ca9c027eb9cd61b52195a78dfcc6711.patch";
      hash = "sha256-wNp47EFtjXv6jIFX25IErXg83ksmGRNFKNeMFS+tP6s=";
      url = "https://github.com/jterrace/pyssim/commit/64a58687f261eb397e9c22609b5d48497ef02762.patch?full_index=1";
      hash = "sha256-u6okuWZgGcYlf/SW0QLrAv0IYuJi7D8RHHEr8DeXKcw=";
    })
  ];

  # Tests are copied from .travis.yml
  # Tests are copied from .github/workflows/python-package.yml
  checkPhase = ''
    $out/bin/pyssim test-images/test1-1.png test-images/test1-1.png | grep 1
    $out/bin/pyssim test-images/test1-1.png test-images/test1-2.png | grep 0.998
@@ -48,11 +46,11 @@ buildPythonPackage rec {
    $out/bin/pyssim --cw --width 128 --height 128 test-images/test3-orig.jpg test-images/test3-rot.jpg | grep 0.938
  '';

  meta = with lib; {
  meta = {
    description = "Module for computing Structured Similarity Image Metric (SSIM) in Python";
    mainProgram = "pyssim";
    homepage = "https://github.com/jterrace/pyssim";
    license = licenses.mit;
    maintainers = with maintainers; [ jluttine ];
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ jluttine ];
  };
}