Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-pyssim for openSUSE:Factory 
checked in at 2023-03-06 18:56:31
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pyssim (Old)
 and      /work/SRC/openSUSE:Factory/.python-pyssim.new.31432 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-pyssim"

Mon Mar  6 18:56:31 2023 rev:4 rq:1069599 version:0.5

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pyssim/python-pyssim.changes      
2021-02-15 23:19:56.911722741 +0100
+++ /work/SRC/openSUSE:Factory/.python-pyssim.new.31432/python-pyssim.changes   
2023-03-06 18:56:35.000980647 +0100
@@ -1,0 +2,7 @@
+Mon Mar  6 11:17:51 UTC 2023 - Daniel Garcia <[email protected]>
+
+- Add numpy120.patch to support numpy 1.20 gh#jterrace/pyssim#44
+- Update to 0.5
+  * No release notes found
+
+-------------------------------------------------------------------

Old:
----
  v0.4.tar.gz

New:
----
  numpy120.patch
  pyssim-0.5.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-pyssim.spec ++++++
--- /var/tmp/diff_new_pack.LMJhwG/_old  2023-03-06 18:56:35.748984463 +0100
+++ /var/tmp/diff_new_pack.LMJhwG/_new  2023-03-06 18:56:35.752984484 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-pyssim
 #
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2023 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -16,17 +16,18 @@
 #
 
 
-%{?!python_module:%define python_module() python-%{**} python3-%{**}}
 %global skip_python36 1
 Name:           python-pyssim
-Version:        0.4
+Version:        0.5
 Release:        0
 Summary:        Structured Similarity Image Metric (SSIM)
 License:        MIT
 Group:          Development/Languages/Python
 URL:            https://github.com/jterrace/pyssim
-Source:         https://github.com/jterrace/pyssim/archive/v%{version}.tar.gz
+Source:         
https://files.pythonhosted.org/packages/source/p/pyssim/pyssim-%{version}.tar.gz
 Patch0:         Pillow-imports.patch
+# PATCH-FIX-UPSTREAM numpy120.patch gh#jterrace/pyssim#44
+Patch1:         numpy120.patch
 BuildRequires:  %{python_module setuptools}
 BuildRequires:  fdupes
 BuildRequires:  python-rpm-macros
@@ -34,7 +35,7 @@
 Requires:       python-numpy
 Requires:       python-scipy
 Requires(post): update-alternatives
-Requires(postun): update-alternatives
+Requires(postun):update-alternatives
 BuildArch:      noarch
 # SECTION test requirements
 BuildRequires:  %{python_module Pillow}
@@ -47,8 +48,7 @@
 Module for computing Structured Similarity Image Metric (SSIM) in Python.
 
 %prep
-%setup -q -n pyssim-%{version}
-%patch0 -p1
+%autosetup -p1 -n pyssim-%{version}
 
 %build
 %python_build
@@ -77,6 +77,7 @@
 %license LICENSE.md
 %doc README.md
 %python_alternative %{_bindir}/pyssim
-%{python_sitelib}/*
+%{python_sitelib}/ssim
+%{python_sitelib}/pyssim-%{version}*-info
 
 %changelog

++++++ numpy120.patch ++++++
>From fa854ac6b4c2a691a418cfac0eb5a2305731576c Mon Sep 17 00:00:00 2001
From: "adria.labay" <[email protected]>
Date: Wed, 8 Feb 2023 15:40:36 +0100
Subject: [PATCH] support numpy 1.20

---
 ssim/utils.py | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

Index: pyssim-0.5/ssim/utils.py
===================================================================
--- pyssim-0.5.orig/ssim/utils.py
+++ pyssim-0.5/ssim/utils.py
@@ -2,31 +2,29 @@
 
 from __future__ import absolute_import
 
-import numpy
-from numpy.ma.core import exp
+import numpy as np
 import scipy.ndimage
 
 from ssim.compat import ImageOps
 
+
 def convolve_gaussian_2d(image, gaussian_kernel_1d):
     """Convolve 2d gaussian."""
-    result = scipy.ndimage.filters.correlate1d(
+    result = scipy.ndimage.correlate1d(
         image, gaussian_kernel_1d, axis=0)
-    result = scipy.ndimage.filters.correlate1d(
+    return scipy.ndimage.correlate1d(
         result, gaussian_kernel_1d, axis=1)
-    return result
+
 
 def get_gaussian_kernel(gaussian_kernel_width=11, gaussian_kernel_sigma=1.5):
     """Generate a gaussian kernel."""
     # 1D Gaussian kernel definition
-    gaussian_kernel_1d = numpy.ndarray((gaussian_kernel_width))
-    norm_mu = int(gaussian_kernel_width / 2)
+    gaussian_kernel_1d = np.arange(0, gaussian_kernel_width, 1.)
+    gaussian_kernel_1d -= gaussian_kernel_width / 2
+    gaussian_kernel_1d = np.exp(-0.5 * gaussian_kernel_1d**2 /
+                                gaussian_kernel_sigma**2)
+    return gaussian_kernel_1d / np.sum(gaussian_kernel_1d)
 
-    # Fill Gaussian kernel
-    for i in range(gaussian_kernel_width):
-        gaussian_kernel_1d[i] = (exp(-(((i - norm_mu) ** 2)) /
-                                     (2 * (gaussian_kernel_sigma ** 2))))
-    return gaussian_kernel_1d / numpy.sum(gaussian_kernel_1d)
 
 def to_grayscale(img):
     """Convert PIL image to numpy grayscale array and numpy alpha array.
@@ -37,11 +35,11 @@ def to_grayscale(img):
     Returns:
       (gray, alpha): both numpy arrays.
     """
-    gray = numpy.asarray(ImageOps.grayscale(img)).astype(numpy.float)
+    gray = np.asarray(ImageOps.grayscale(img)).astype(float)
 
     imbands = img.getbands()
     alpha = None
     if 'A' in imbands:
-        alpha = numpy.asarray(img.split()[-1]).astype(numpy.float)
+        alpha = np.asarray(img.split()[-1]).astype(float)
 
     return gray, alpha

Reply via email to