Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-samplerate for openSUSE:Factory checked in at 2021-04-23 17:50:46 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-samplerate (Old) and /work/SRC/openSUSE:Factory/.python-samplerate.new.12324 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-samplerate" Fri Apr 23 17:50:46 2021 rev:2 rq:888043 version:0.1.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-samplerate/python-samplerate.changes 2018-11-09 07:56:45.571550692 +0100 +++ /work/SRC/openSUSE:Factory/.python-samplerate.new.12324/python-samplerate.changes 2021-04-23 17:51:03.086838100 +0200 @@ -1,0 +2,7 @@ +Fri Apr 23 12:00:39 UTC 2021 - Ben Greiner <[email protected]> + +- Skip python36 build: With NumPy 1.20, python36-numpy is no + longer available in Tumbleweed (NEP 29) +- Enable tests: download test_samplerate.py from GitHub + +------------------------------------------------------------------- New: ---- test_samplerate.py ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-samplerate.spec ++++++ --- /var/tmp/diff_new_pack.ExAMA8/_old 2021-04-23 17:51:03.534838870 +0200 +++ /var/tmp/diff_new_pack.ExAMA8/_new 2021-04-23 17:51:03.538838878 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-samplerate # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# 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 @@ -12,33 +12,41 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# %{?!python_module:%define python_module() python-%{**} python3-%{**}} +%define skip_python36 1 +%bcond_without python2 Name: python-samplerate Version: 0.1.0 Release: 0 License: MIT Summary: Python bindings for libsamplerate -Url: https://github.com/tuxu/python-samplerate +URL: https://github.com/tuxu/python-samplerate Group: Development/Languages/Python Source0: https://files.pythonhosted.org/packages/source/s/samplerate/samplerate-%{version}.tar.gz +Source1: https://github.com/tuxu/python-samplerate/raw/%{version}/tests/test_samplerate.py Source100: python-samplerate-rpmlintrc -BuildRequires: python-rpm-macros -BuildRequires: %{python_module devel} BuildRequires: %{python_module setuptools} -BuildRequires: %{python_module cffi >= 1.0.0} -BuildRequires: %{python_module pytest-runner} +BuildRequires: python-rpm-macros # SECTION test requirements BuildRequires: %{python_module cffi >= 1.0.0} BuildRequires: %{python_module numpy} BuildRequires: %{python_module pytest} +BuildRequires: libsamplerate +%if %{with python2} +BuildRequires: python-enum34 +%endif # /SECTION BuildRequires: fdupes +Requires: libsamplerate Requires: python-cffi >= 1.0.0 Requires: python-numpy -Requires: libsamplerate +%ifpython2 +Requires: python-enum34 +%endif BuildArch: noarch %python_subpackages @@ -58,6 +66,9 @@ %prep %setup -q -n samplerate-%{version} +mkdir tests +cp %{SOURCE1} tests/ +sed -i -e "s/, 'pytest-runner'//" -e "/tests_require/ d" setup.py %build %python_build @@ -69,9 +80,13 @@ # Remove unneeded mac and windows library binaries %python_expand rm %{buildroot}%{$python_sitelib}/samplerate/_samplerate_data/*.* +%check +%pytest + %files %{python_files} %doc README.rst %license LICENSE.rst -%{python_sitelib}/* +%{python_sitelib}/samplerate +%{python_sitelib}/samplerate-%{version}*-info %changelog ++++++ test_samplerate.py ++++++ import numpy as np import pytest import samplerate @pytest.fixture(scope="module", params=[1, 2]) def data(request): num_channels = request.param periods = np.linspace(0, 10, 1000) input_data = [ np.sin(2 * np.pi * periods + i * np.pi / 2) for i in range(num_channels) ] return ((num_channels, input_data[0]) if num_channels == 1 else (num_channels, np.transpose(input_data))) @pytest.fixture(params=list(samplerate.converters.ConverterType)) def converter_type(request): return request.param def test_simple(data, converter_type, ratio=2.0): _, input_data = data samplerate.resample(input_data, ratio, converter_type) def test_process(data, converter_type, ratio=2.0): num_channels, input_data = data src = samplerate.Resampler(converter_type, num_channels) src.process(input_data, ratio) def test_match(data, converter_type, ratio=2.0): num_channels, input_data = data output_simple = samplerate.resample(input_data, ratio, converter_type) resampler = samplerate.Resampler(converter_type, channels=num_channels) output_full = resampler.process(input_data, ratio, end_of_input=True) assert np.allclose(output_simple, output_full) def test_callback(data, converter_type, ratio=2.0): from samplerate import CallbackResampler _, input_data = data def producer(): yield input_data while True: yield None callback = lambda p=producer(): next(p) with CallbackResampler(callback, ratio, converter_type) as resampler: resampler.read(int(ratio) * input_data.shape[0])
