%define _python_dist_allow_version_zero 1

Name:           python-emote
Version:        4.0.1
Release:        4%{?dist}
Summary:        Emoji Picker for Linux written in GTK3

License:        GPL-3.0
URL:            https://github.com/tom-james-watson/Emote
Source:         %{url}/archive/v%{version}/Emote-%{version}.tar.gz

Patch0001:      fix_dep_versions.patch
Patch0002:      remove_manimpango.patch
Patch0003:      0001-Add-data-to-setup.py.patch
Patch0004:      0002-Update-desktop-file.patch
Patch0005:      emote_wayland_autopaste.patch

BuildArch:      noarch
BuildRequires:  python3-devel perl-interpreter

%global _description %{expand:
Emote is a modern emoji picker for Linux. Written in GTK3, Emote is lightweight
and stays out of your way. Launch the emoji picker with the configurable
keyboard shortcut, and select one or more emojis to have them be
automatically pasted into your currently focused app.}

%description %_description

%package -n python3-emote
Summary:        %{summary}
Requires:       xdotool ydotool keybinder3

%description -n python3-emote %_description


%prep
%autosetup -p1 -n Emote-%{version}
cp %{_builddir}/Emote-%{version}/static/logo.svg %{_builddir}/Emote-%{version}/static/emote.svg
cp -r %{_builddir}/Emote-%{version}/static %{_builddir}/Emote-%{version}/emote/static
perl -i -pe 's,"static,"%{python3_sitelib}/emote/static,' emote/*.py

%generate_buildrequires
%pyproject_buildrequires -t


%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files emote


%files -n python3-emote -f %{pyproject_files}
%doc README.*
%license LICENSE.md
%{_bindir}/emote
%{_datarootdir}/applications/com.tomjwatson.Emote.desktop
%{_datarootdir}/icons/hicolor/scalable/apps/emote.svg


%changelog
* Thu Dec 26 2024 Dave Vasilevsky <dave@vasilevsky.ca> - 4.0.1-3
- Revert to original upstream
- Add auto-paste on Wayland using ydotool
- Fix paths to static files
- Add keybinder3 dependency

* Thu Jan 25 2024 Juraj Marcin <juraj@jurajmarcin.com> - 4.0.2-2style.css
- Copy static files needed at runtime

* Thu Jan 25 2024 Juraj Marcin <juraj@jurajmarcin.com> - 4.0.2-1
- Add xdotool dependency
- Add data files (icon, desktop)

* Wed Jan 24 2024 Juraj Marcin <juraj@jurajmarcin.com> - 4.0.2-0
- Initial release