File autokey.spec of Package autokey

#
# spec file for package autokey
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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/
#


Name:           autokey
Version:        0.95.9
Release:        0
Summary:        Desktop automation utility for Linux and X11
# FIXME: Select a correct license from https://github.com/openSUSE/spec-cleaner#spdx-licenses
# FIXME: use correct group, see "https://en.opensuse.org/openSUSE:Package_group_guidelines"
License:        GPL-3.0-only
Group:          System/X11/Utilities
URL:            https://autokey.github.io
Source:         https://github.com/autokey/autokey/archive/autokey-%{version}.tar.gz
Source1:        autokey.png
BuildRequires:  dbus-1-python3
BuildRequires:  fdupes
BuildRequires:  python3 >= 3.5
BuildRequires:  python3-base
BuildRequires:  python3-qt5-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-sip
BuildRequires:  python3-tools
BuildRequires:  update-desktop-files
BuildArch:      noarch

# Clean ups requirements - we do that because system packages are not well 
# registered and load_entry_point cannot find them
Patch0:         pip_requirements.patch

%description
AutoKey is a desktop automation utility for Linux and X11. It allows the
automation of virtually any task by responding to typed abbreviations
and hotkeys. It offers a full-featured GUI that makes it highly
accessible for novices, as well as a scripting interface offering the
full flexibility and power of the Python language.

%package common
Summary:        Desktop automation utility -- Common Files
Group:          System/X11/Utilities
Requires:       python3-simplejson
Requires:       python3-python-xlib
Requires:       wmctrl
Recommends:     %{name}-gtk
Recommends:     %{name}-qt

%description common
AutoKey is a desktop automation utility for Linux and X11. It allows the
automation of virtually any task by responding to typed abbreviations
and hotkeys. It offers a full-featured GUI that makes it highly
accessible for novices, as well as a scripting interface offering the
full flexibility and power of the Python language.

%package gtk
Summary:        Desktop automation utility -- GTK+ Interface
Group:          System/X11/Utilities
Requires:       %{name}-common = %{version}
Requires:       python3-atspi
Requires:       python3-gobject
Requires:       python3-notify2
Requires:       python3-qscintilla-qt5

%description gtk
AutoKey is a desktop automation utility for Linux and X11. It allows the
automation of virtually any task by responding to typed abbreviations
and hotkeys. It offers a full-featured GUI that makes it highly
accessible for novices, as well as a scripting interface offering the
full flexibility and power of the Python language.

%package qt
Summary:        Desktop automation utility -- Qt Interface
Group:          System/X11/Utilities
Requires:       %{name}-common = %{version}
Requires:       python3-pyinotify
Requires:       python3-qscintilla-qt5
Requires:       python3-qt5
Requires:       python3-typing

%description qt
AutoKey is a desktop automation utility for Linux and X11. It allows the
automation of virtually any task by responding to typed abbreviations
and hotkeys. It offers a full-featured GUI that makes it highly
accessible for novices, as well as a scripting interface offering the
full flexibility and power of the Python language.


%prep
%setup -q
%patch0 -p1
find lib/%{name}/ -name "*.py" -exec sed -i 's|#!%{_bindir}/env python|#%{_bindir}/python3|' {} ";"

%build
python3 setup.py build

%install
python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}
cp %{SOURCE1} %{buildroot}%{_datadir}/icons/hicolor/96x96/apps/
%suse_update_desktop_file %{name}-qt DesktopSettings
%suse_update_desktop_file %{name}-gtk DesktopSettings
find %{buildroot}%{_datadir}/icons/ -name '*.svg' -exec chmod -x {} ";"
%fdupes %{buildroot}%{$python_sitelib}

%files common
%doc ACKNOWLEDGMENTS README.rst CHANGELOG.rst
%license LICENSE
%dir %{python3_sitelib}/%{name}
%{python3_sitelib}/%{name}/*.py*
%exclude %{python3_sitelib}/%{name}/gtkapp.py
%exclude %{python3_sitelib}/%{name}/qtapp.py
%{python3_sitelib}/%{name}-*.egg-info
%dir %{_datadir}/icons/Humanity
%dir %{_datadir}/icons/Humanity/scalable
%dir %{_datadir}/icons/Humanity/scalable/apps
%dir %{_datadir}/icons/hicolor/96x96
%dir %{_datadir}/icons/hicolor/96x96/apps
%dir %{_datadir}/icons/hicolor/scalable
%dir %{_datadir}/icons/hicolor/scalable/apps
%dir %{_datadir}/icons/ubuntu-mono-dark
%dir %{_datadir}/icons/ubuntu-mono-dark/apps
%dir %{_datadir}/icons/ubuntu-mono-dark/apps/48
%dir %{_datadir}/icons/ubuntu-mono-light
%dir %{_datadir}/icons/ubuntu-mono-light/apps
%dir %{_datadir}/icons/ubuntu-mono-light/apps/48
%{_datadir}/icons/Humanity/scalable/apps/%{name}-status*.svg
%{_datadir}/icons/ubuntu-mono-dark/apps/48/%{name}-status*.svg
%{_datadir}/icons/ubuntu-mono-light/apps/48/%{name}-status*.svg
%{_datadir}/icons/hicolor/96x96/apps/autokey.png
%{_datadir}/icons/hicolor/scalable/apps/autokey*.svg
%{_bindir}/%{name}-run
%{_mandir}/man1/%{name}-run.1%{?ext_man}
%{_bindir}/%{name}-shell
%dir %{python3_sitelib}/%{name}/__pycache__
%{python3_sitelib}/%{name}/__pycache__/*
%exclude %{python3_sitelib}/%{name}/__pycache__/gtkapp.cpython-*.pyc
%exclude %{python3_sitelib}/%{name}/__pycache__/qtapp.cpython-*.pyc
%dir %{python3_sitelib}/%{name}/iomediator
%{python3_sitelib}/%{name}/iomediator/*
%dir %{python3_sitelib}/%{name}/iomediator/__pycache__
%{python3_sitelib}/%{name}/iomediator/__pycache__/*

%files gtk
%{_bindir}/%{name}-gtk
%{python3_sitelib}/%{name}/gtkapp.py*
%{python3_sitelib}/%{name}/gtkui/
%{python3_sitelib}/%{name}/__pycache__/gtkapp.cpython-*.pyc
%{_datadir}/applications/%{name}-gtk.desktop
%{_mandir}/man1/%{name}-gtk.1%{?ext_man}

%files qt
%{_bindir}/%{name}-qt
%{python3_sitelib}/%{name}/qtapp.py*
%{python3_sitelib}/%{name}/qtui/
%{python3_sitelib}/%{name}/__pycache__/qtapp.cpython-*.pyc
%{_datadir}/applications/%{name}-qt.desktop
%{_mandir}/man1/%{name}-qt.1%{?ext_man}

%changelog
openSUSE Build Service is sponsored by