File tuhi.spec of Package tuhi

#
# spec file for package tuhi
#
# Copyright (c) 2022 SUSE LLC
# Copyright (c) 2022 Florian "sp1rit" <packaging@sp1rit.anonaddy.me>
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#

%define pythons python3

%define uuid org.freedesktop.Tuhi
Name:           tuhi
Version:        0.6
Release:        0
Summary:        Access Wacom SmartPad devices 
License:        GPL-2.0
URL:            https://github.com/tuhiproject/tuhi
Source0:        https://github.com/tuhiproject/tuhi/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz
BuildArch:      noarch
BuildRequires:  hicolor-icon-theme
BuildRequires:  fdupes
BuildRequires:  meson >= 0.50.0
# the grep invocation of %%find_lang fails otherwise
BuildRequires:  pcre
BuildRequires:  pkgconfig(pygobject-3.0)
BuildRequires:  python3
BuildRequires:  %{python_module cairo}
BuildRequires:  %{python_module gobject}
BuildRequires:  %{python_module svgwrite}
BuildRequires:  %{python_module xdg}
%if 0%{?suse_version}
BuildRequires:	update-desktop-files
%endif
Requires:  %{python_module cairo}
Requires:  %{python_module gobject}
Requires:  %{python_module svgwrite}
Requires:  %{python_module xdg}

%description
Tuhi is a GTK application that connects to and fetches the data from the Wacom ink range (Spark, Slate, Folio, Intuos Paper, ...). Users can save the data as SVGs.

%lang_package

%prep
%autosetup -p1
# Removing unnecessary shebangs
find ./%{name} -perm 644 -name "*.py" -type f -exec sed -i '1d' {} \;
# replace /usr/bin/env python3 with proper shebang for RPM
find . -type f -perm 755 '(' -name "*.in" -o -name "*.py" ')' -exec sed -e 's|/usr/bin/env python3|%{__python3}|g' -i "{}" \;

%build
%meson
%meson_build

%install
%meson_install

%if 0%{?suse_version}
%suse_update_desktop_file %{uuid}
%endif
%fdupes %{buildroot}%{_datadir}/icons/hicolor/

%find_lang %{name}

%files
%license COPYING
%doc README.md
%{_bindir}/%{name}
%{python_sitelib}/%{name}/
%{_libexecdir}/%{name}/
%{_datadir}/applications/%{uuid}.desktop
%{_datadir}/icons/hicolor/%{uuid}.svg
%{_datadir}/icons/hicolor/{scalable,symbolic}/apps/%{uuid}*.svg
%{_datadir}/metainfo/%{uuid}.appdata.xml
%{_datadir}/%{name}/

%files lang -f %{name}.lang

%changelog
openSUSE Build Service is sponsored by