%global modname OdfEdit
%global date 2024-06-23
Name: ODFEdit
Version: 2.14
Release: 1%{?dist}
Summary: Tool for GrandOrgue organ definition file edition and generation
License: GPL-3.0-only
URL: https://github.com/GrandOrgue/ODFEdit
Source: https://github.com/GrandOrgue/OdfEdit/archive/refs/tags/v%{version}.tar.gz
BuildArch: noarch
BuildRequires: python3-devel, desktop-file-utils
Recommends: GrandOrgue
%py_provides python3-%{modname}
%description
OdfEdit is a Python script permitting to edit an ODF (Organ Description File, extension .organ)
for GrandOrgue in plain text mode, with syntax check and help included.
%prep
%setup -qn %{modname}-%{version}
mv src odf_edit
cat << EOF >> ./pyproject.toml
[project.scripts]
OdfEdit = "odf_edit:OdfEdit.main"
EOF
cat << EOF > ./odf_edit/__init__.py
from . import OdfEdit
EOF
sed -i -e 's/"tkinter",//g' ./pyproject.toml
sed -i -e 's/\["src"\]/["odf_edit","odf_edit.resources"]/g' ./pyproject.toml
sed -i -e 's/mypkg/"odf_edit.resources"/g' ./pyproject.toml
%generate_buildrequires
%pyproject_buildrequires -t
%build
%pyproject_wheel
%install
%pyproject_install
%pyproject_save_files odf_edit
mkdir -p %{buildroot}%{_datadir}/applications
cat << EOF > %{buildroot}%{_datadir}/applications/%{name}.desktop
[Desktop Entry]
Version=1.0
Name=%{name}
GenericName=%{summary}
Exec=OdfEdit %f
Icon=OdfEdit
Terminal=false
Type=Application
Categories=Audio;AudioVideo;Music;
MimeType=application/x-grandorgue-odf;
EOF
desktop-file-install --delete-original --dir=%{buildroot}%{_datadir}/applications %{buildroot}%{_datadir}/applications/%{name}.desktop
mkdir -p %{buildroot}%{_datadir}/metainfo
cat << EOF > %{buildroot}%{_datadir}/metainfo/%{name}.appdata.xml
net.sourceforge.%{name}GPL-3.0%{name}%{summary}%{url}
OdfEdit is a Python script permitting to edit an ODF (Organ Description File, extension .organ) for GrandOrgue in plain text mode, with syntax check and help included.
%{name}.desktop%{name}
EOF
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/32x32/apps
cp %{buildroot}%{python3_sitelib}/odf_edit/resources/OdfEdit.png %{buildroot}%{_datadir}/icons/hicolor/32x32/apps/OdfEdit.png
%check
%tox
%files -f %{pyproject_files}
%doc README.md
%{_bindir}/OdfEdit
%{_datadir}/applications/%{name}.desktop
%{_datadir}/metainfo/%{name}.appdata.xml
%{_datadir}/icons/hicolor/32x32/apps/OdfEdit.png
%changelog
* Wed Oct 2 2024 Kerkovits Krisztián - 2.14-1
- Update version
* Tue Jun 25 2024 Kerkovits Krisztián - 2.13-1
- Update version
* Mon Jun 10 2024 Kerkovits Krisztián - 2.12-1
- Update version
* Mon Apr 22 2024 Kerkovits Krisztián - 2.11-1
- Update version
* Sun Mar 31 2024 Kerkovits Krisztián - 2.10-1
- Update version
* Thu Nov 23 2023 Kerkovits Krisztián - 2.8-1
- Update version
* Fri Nov 10 2023 Kerkovits Krisztián - 2.7-1
- Update version
* Thu Jun 1 2023 Kerkovits Krisztián - 2.4-1
- Update version
* Wed May 17 2023 Kerkovits Krisztián - 2.3-1
- Initial package