File input-remapper.spec of Package input-remapper
#
# spec file for package input-remapper
#
# Copyright (c) 2025 SUSE LLC
#
# 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/
#
%{?sle15_python_module_pythons}%{!?sle15_python_module_pythons:%define pythons %{primary_python}}
Name: input-remapper
Version: 2.1.1
Release: 0
Summary: An easy to use tool to change the behaviour of your input devices
License: GPL-3.0-or-later
URL: https://github.com/sezanzeb/input-remapper
Source0: %{url}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Patch0: fix-locale-path.patch
BuildRequires: %{python_module cairo}
BuildRequires: %{python_module evdev}
BuildRequires: %{python_module gobject-Gdk}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module psutil}
BuildRequires: %{python_module pydantic}
BuildRequires: %{python_module pydbus}
BuildRequires: %{python_module pygobject}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: hicolor-icon-theme
BuildRequires: python-rpm-macros
BuildRequires: pkgconfig(gobject-introspection-1.0)
BuildRequires: pkgconfig(gtk+-3.0)
BuildRequires: pkgconfig(gtksourceview-4)
BuildRequires: pkgconfig(systemd)
BuildRequires: pkgconfig(udev)
Requires: %{pythons}-cairo
Requires: %{pythons}-evdev
Requires: %{pythons}-pydantic
Requires: %{pythons}-pydbus
Requires: %{pythons}-pygobject
Requires: %{pythons}-setuptools
Requires: procps
BuildArch: noarch
%{?systemd_requires}
%description
An easy to use tool for Linux to change the behaviour of your input devices.
Supports X11, Wayland, combinations, programmable macros, joysticks, wheels,
triggers, keys, mouse-movements and more. Maps any input to any other input.
%lang_package
%prep
%autosetup -p1
%build
%pyproject_wheel
%install
%pyproject_install
install -d %{buildroot}%{_udevrulesdir}
install -d %{buildroot}%{_unitdir}
mv %{buildroot}%{python_sitelib}%{_bindir} %{buildroot}%{_bindir}
mv %{buildroot}%{python_sitelib}%{_datadir} %{buildroot}%{_datadir}
mv %{buildroot}%{python_sitelib}%{_sysconfdir} %{buildroot}%{_distconfdir}
mv %{buildroot}%{python_sitelib}%{_unitdir}/%{name}.service %{buildroot}%{_unitdir}/%{name}.service
mv %{buildroot}%{python_sitelib}%{_udevrulesdir}/99-%{name}.rules %{buildroot}%{_udevrulesdir}/99-%{name}.rules
# fix shebang
%python3_fix_shebang
#fix upstream
rm %{buildroot}%{_datadir}/%{name}/{%{name}-gtk.desktop,inputremapper.Control.conf,input-remapper.svg,input-remapper.policy,io.github.sezanzeb.input_remapper.metainfo.xml}
rm -r %{buildroot}%{_datadir}/%{name}/locale/*_*
sed -i 's|#!/usr/bin/env python3||g' %{buildroot}%{python_sitelib}/inputremapper/injection/macros/*.py
sed -i 's|#!/usr/bin/env python3||g' %{buildroot}%{python_sitelib}/inputremapper/injection/macros/tasks/*.py
%find_lang %{name}
%fdupes -s %{buildroot}
%pre
%service_add_pre %{name}.service
%post
%service_add_post %{name}.service
%preun
%service_del_preun %{name}.service
%postun
%service_del_postun %{name}.service
%files
%license LICENSE
%doc README.md
%exclude %{_datadir}/%{name}/locale
%{_bindir}/%{name}-control
%{_bindir}/%{name}-gtk
%{_bindir}/%{name}-reader-service
%{_bindir}/%{name}-service
%{_datadir}/%{name}
%{_datadir}/applications/%{name}-gtk.desktop
%{_datadir}/dbus-1/system.d/inputremapper.Control.conf
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
%{_datadir}/metainfo/io.github.sezanzeb.input_remapper.metainfo.xml
%{_datadir}/polkit-1/actions/%{name}.policy
%{_distconfdir}/xdg/autostart/%{name}-autoload.desktop
%{_udevrulesdir}/99-%{name}.rules
%{_unitdir}/%{name}.service
%{python_sitelib}/input_remapper-%{version}.dist-info
%{python_sitelib}/inputremapper
%files lang -f %{name}.lang
%dir %{_datadir}/%{name}/locale
%dir %{_datadir}/%{name}/locale/*
%dir %{_datadir}/%{name}/locale/*/*
%changelog