1
0

Accepting request 877789 from home:bnavigator:branches:devel:languages:python:numeric

- 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)

OBS-URL: https://build.opensuse.org/request/show/877789
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-python-sofa?expand=0&rev=7
This commit is contained in:
2021-03-10 09:55:01 +00:00
committed by Git OBS Bridge
parent 46c8e69747
commit b79bc5f13d
5 changed files with 70 additions and 7 deletions

View File

@@ -1,3 +1,12 @@
-------------------------------------------------------------------
Mon Mar 8 16:30:44 UTC 2021 - Ben Greiner <code@bnavigator.de>
- 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 <mcalabkova@suse.com>

View File

@@ -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

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1f7114f3bc193763443ead93f4ade4aa6566c27e0363386c7e2fc3fff8ec7c89
size 8831437

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b6c0faf989d0d236e4dac7f5726a0d876dc812fa7f35fcb4e2ba473f2597e143
size 18821

View File

@@ -0,0 +1,40 @@
From 5b1cd60f886ec227bcdc34a2ffa560eb0ccbbb33 Mon Sep 17 00:00:00 2001
From: Ben Greiner <code@bnavigator.de>
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):