## START: Set by rpmautospec
## (rpmautospec version 0.3.0)
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 2;
    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

Name:           NiaAML-GUI
Version:        0.1.13
Release:        %autorelease
Summary:        GUI for NiaAML Python package

# SPDX
License:        MIT
URL:            https://github.com/lukapecnik/NiaAML-GUI
# Also distributed via PyPI (https://pypi.org/project/niaaml-gui/) but without
# tests and other auxiliary files.
Source0:        %{url}/archive/%{version}/NiaAML-GUI-%{version}.tar.gz

BuildArch:      noarch
 
BuildRequires:  python3-devel
BuildRequires:  desktop-file-utils
BuildRequires:  libappstream-glib

# pyproject.toml: [tool.poetry.dev-dependencies]
# pytest = "^5.2"
# Version specification loosened to allow newer versions
BuildRequires:  python3dist(pytest) >= 5.2

Requires:       hicolor-icon-theme

%global app_id io.github.lukapecnik.niaaml_gui

%global common_description %{expand:
This is a basic graphical user interface intended for users of the NiaAML
Python package.}

%description %{common_description}


%prep
%autosetup


%generate_buildrequires
%pyproject_buildrequires


%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files niaaml_gui

desktop-file-install --dir='%{buildroot}%{_datadir}/applications' \
    AppData/%{app_id}.desktop
install -t '%{buildroot}%{_metainfodir}' -p -m 0644 -D \
    AppData/%{app_id}.metainfo.xml
install -t '%{buildroot}%{_datadir}/icons/hicolor/256x256/apps' -p -m 0644 -D \
    AppData/niaaml-gui.png


%check
appstream-util validate-relax --nonet \
    '%{buildroot}%{_metainfodir}/%{app_id}.metainfo.xml'

%pytest


%files -f %{pyproject_files}
%license LICENSE
%doc CITATION.cff
%doc README.md
# README.rst is present but empty.

%{_bindir}/NiaAML-GUI
# There is no need for a man page, since this is a pure GUI application with no
# useful command-line options.

%{_datadir}/applications/%{app_id}.desktop
%{_metainfodir}/%{app_id}.metainfo.xml
%{_datadir}/icons/hicolor/256x256/apps/niaaml-gui.png


%changelog
* Wed Jan 18 2023 Fedora Release Engineering <releng@fedoraproject.org> 0.1.13-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Sun Oct 23 2022 Benjamin A. Beasley <code@musicinmybrain.net> 0.1.13-1
- Update to 0.1.13 (close RHBZ#2137087)

* Wed Oct 19 2022 Benjamin A. Beasley <code@musicinmybrain.net> 0.1.11^20211203gitfff3dd3-1
- Use a post-release snapshot instead of a large number of patches
- Drop CODE_OF_CONDUCT.md from the package, as it is mostly relevant for
  upstream development.
- Add new CITATION.cff to the package.

* Wed Oct 19 2022 Benjamin A. Beasley <code@musicinmybrain.net> 0.1.11-5
- Clarify that License is SPDX MIT

* Wed Jul 20 2022 Fedora Release Engineering <releng@fedoraproject.org> 0.1.11-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Mon Jul 04 2022 Python Maint <python-maint@redhat.com> 0.1.11-3
- Rebuilt for Python 3.11

* Wed Jan 19 2022 Fedora Release Engineering <releng@fedoraproject.org> 0.1.11-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Tue Nov 23 2021 Benjamin A. Beasley <code@musicinmybrain.net> 0.1.11-1
- Initial package