diff --git a/python-python-sofa.changes b/python-python-sofa.changes index 2edd8b1..57f0250 100644 --- a/python-python-sofa.changes +++ b/python-python-sofa.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Mon Mar 8 16:30:44 UTC 2021 - Ben Greiner + +- Add python-sofa-pr4-scipy1_6.patch gh#spatialaudio/python-sofa#4 +- Switch to Github Source Archive for the example notebook to test + with pytest --nbval +- Skip python36 build: With NumPy 1.20, python36-numpy is no + longer available in Tumbleweed (NEP 29) + ------------------------------------------------------------------- Tue Jul 14 14:44:29 UTC 2020 - Marketa Calabkova diff --git a/python-python-sofa.spec b/python-python-sofa.spec index 4bef507..126f066 100644 --- a/python-python-sofa.spec +++ b/python-python-sofa.spec @@ -1,7 +1,7 @@ # # spec file for package python-python-sofa # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,20 +17,27 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} +%define skip_python36 1 Name: python-python-sofa Version: 0.2.0 Release: 0 Summary: Spatially Oriented Format for Acoustics (SOFA) API for Python License: MIT Group: Development/Languages/Python -URL: https://github.com/spatialaudio/python-sofa/ -Source: https://files.pythonhosted.org/packages/source/p/python-sofa/python-sofa-%{version}.tar.gz +URL: https://github.com/spatialaudio/python-sofa +# get examples for rudimentary testing from GitHub archive +Source: %{url}/archive/v%{version}.tar.gz#/python-sofa-%{version}-gh.tar.gz +# PATCH-FIX-UPSTREAM python-sofa-pr4-scipy1_6.patch gh#spatialaudio/python-sofa#4 +Patch0: https://github.com/spatialaudio/python-sofa/pull/4.patch#/python-sofa-pr4-scipy1_6.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module setuptools} BuildRequires: python-rpm-macros # SECTION test requirements +BuildRequires: %{python_module matplotlib} +BuildRequires: %{python_module nbval} BuildRequires: %{python_module netCDF4} BuildRequires: %{python_module numpy} +BuildRequires: %{python_module pytest} BuildRequires: %{python_module scipy >= 1.2.0} # /SECTION BuildRequires: fdupes @@ -46,7 +53,7 @@ A Python API for reading, writing and creating SOFA files as defined by the SOFA conventions (version 1.0). %prep -%setup -q -n python-sofa-%{version} +%autosetup -p1 -n python-sofa-%{version} %build %python_build @@ -55,6 +62,13 @@ by the SOFA conventions (version 1.0). %python_install %python_expand %fdupes %{buildroot}%{$python_sitelib} +%check +echo '[regex1] +regex: DateCreated: .* +replace: DateCreated: 0000-00-00 00:00:00 +' > nodate.cfg +%pytest --nbval --sanitize-with nodate.cfg doc/examples/SOFA-file-access.ipynb + %files %{python_files} %doc README.rst %license LICENSE diff --git a/python-sofa-0.2.0-gh.tar.gz b/python-sofa-0.2.0-gh.tar.gz new file mode 100644 index 0000000..5a7860b --- /dev/null +++ b/python-sofa-0.2.0-gh.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1f7114f3bc193763443ead93f4ade4aa6566c27e0363386c7e2fc3fff8ec7c89 +size 8831437 diff --git a/python-sofa-0.2.0.tar.gz b/python-sofa-0.2.0.tar.gz deleted file mode 100644 index 46360b6..0000000 --- a/python-sofa-0.2.0.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b6c0faf989d0d236e4dac7f5726a0d876dc812fa7f35fcb4e2ba473f2597e143 -size 18821 diff --git a/python-sofa-pr4-scipy1_6.patch b/python-sofa-pr4-scipy1_6.patch new file mode 100644 index 0000000..f37b96f --- /dev/null +++ b/python-sofa-pr4-scipy1_6.patch @@ -0,0 +1,40 @@ +From 5b1cd60f886ec227bcdc34a2ffa560eb0ccbbb33 Mon Sep 17 00:00:00 2001 +From: Ben Greiner +Date: Mon, 8 Mar 2021 17:52:21 +0100 +Subject: [PATCH] scipy.spatial.transform.Rotation.from_dcm has been renamed to + .from_matrix + +--- + src/sofa/spatial/coordinates.py | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/src/sofa/spatial/coordinates.py b/src/sofa/spatial/coordinates.py +index 7d08ab0..c41d2d3 100644 +--- a/src/sofa/spatial/coordinates.py ++++ b/src/sofa/spatial/coordinates.py +@@ -22,7 +22,15 @@ + import numpy as np + + # for coordinate transformations +-from scipy.spatial.transform import Rotation ## requires scipy 1.2.0 ++from scipy.spatial.transform import Rotation ++ ++ ++try: ++ # SciPy >=1.4 ++ R_from_matrix = Rotation.from_matrix ++except AttributeError: ++ # SciPy >=1.2, < 1.6 ++ R_from_matrix = Rotation.from_dcm + + + def sph2cart(alpha, beta, r): +@@ -107,7 +115,7 @@ def _rotation_from_view_up(view, up): + view = np.repeat(view, ulen, axis=0) + up = np.repeat(up, vlen, axis=0) + y_axis = np.cross(up, view) +- return Rotation.from_dcm(np.moveaxis(np.asarray([view, y_axis, up]), 0, -1)) ++ return R_from_matrix(np.moveaxis(np.asarray([view, y_axis, up]), 0, -1)) + + + def _get_object_transform(ref_object):