## START: Set by rpmautospec
## (rpmautospec version 0.7.2)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 1;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

%global pypi_name mir_eval
%global pypi_version 0.7
%global commit  1fed5327e2a65c3294579beafa03a6498b4da3d0
%global shortcommit %(c=%{commit}; echo ${c:0:7})

Name:           python-%{pypi_name}
Version:        %{pypi_version}^20240816.1fed532
Release:        %autorelease
Summary:        Common metrics for common audio/music processing tasks

License:        MIT
URL:            https://github.com/craffel/%{pypi_name}
Source:         %{url}/archive/%{commit}/%{pypi_name}-%{shortcommit}.tar.gz
BuildArch:      noarch

BuildRequires:  python3-devel
BuildRequires:  python3dist(setuptools)
# Needed for tests
BuildRequires:  python3dist(pytest)
BuildRequires:  python3dist(matplotlib)
BuildRequires:  python3dist(pytest-mpl)
# Documentation uses Sphinx

%description
mir_eval Python library for computing common heuristic accuracy scores for
various music/audio information retrieval/signal processing
tasks.Documentation, including installation and usage information: you're
looking for the mir_eval web service, which you can use to run mir_eval without
installing anything or writing any code, it can be found here:

%package -n     python3-%{pypi_name}
Summary:        %{summary}
%{?python_provide:%python_provide python3-%{pypi_name}}

%description -n python3-%{pypi_name}
mir_eval Python library for computing common heuristic accuracy scores for
various music/audio information retrieval/signal processing
tasks.Documentation, including installation and usage information: you're
looking for the mir_eval web service, which you can use to run mir_eval without
installing anything or writing any code, it can be found here:


%prep
%autosetup -n %{pypi_name}-%{commit}
# Do not measure coverage in tests
sed -i 's/--cov-report term-missing --cov mir_eval --cov-report=xml //g' \
    setup.cfg
%py3_shebang_fix tests/generate_data.py

%generate_buildrequires
%pyproject_buildrequires

%build
%pyproject_wheel

%install
%pyproject_install

#sed -e '1d' -i %{buildroot}%{python3_sitelib}/%{pypi_name}/__init__.py

%pyproject_save_files %{pypi_name}

%check
%pyproject_check_import
pushd tests
 %pytest --mpl --mpl-baseline-path=baseline_images/test_display
popd

%files -n python3-%{pypi_name} -f %{pyproject_files}
%doc README.rst

%changelog
## START: Generated by rpmautospec
* Sun Nov 10 2024 John Doe <packager@example.com> - 0.7^20240816.1fed532-1
- Uncommitted changes
## END: Generated by rpmautospec