File autokey.spec of Package autokey

#
# spec file for package autokey
#
# Copyright (c) 2018 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 http://bugs.opensuse.org/
#

Name:           autokey
Version:        0.96.0
Release:        0
Summary:        Desktop automation utility
License:        GPL-3.0
Group:          System/X11/Utilities
Url:            https://github.com/guoci/autokey-py3
# Source:         https://github.com/autokey/autokey/archive/cd5d6d76b26db6ce8c4871ef5118f3210457077e.zip
Source:         https://github.com/autokey/autokey/archive/%{name}-%{version}.tar.gz
BuildRequires:  python3-devel
BuildRequires:  update-desktop-files
BuildRequires:  python3-sip4-devel >= 4.18.0
BuildRequires:  python3-setuptools
BuildRequires:  dbus-1-python3
BuildRequires:  python3-python-xlib
BuildRequires:  python3-qt5-devel
BuildRequires:  python3-qscintilla-qt5
BuildRequires:  python3-PyHamcrest
BuildRequires:  fdupes
BuildRequires:  python3-tools
# BuildRequires:  ImageMagick
BuildArch:      noarch

%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-dbus-python
Requires:       python3-python-xlib
Requires:       wmctrl
Requires:       xautomation
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-notify2
Requires:       python3-atspi
Requires:       python3-gobject

%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-qscintilla-qt5
Requires:       python3-qt5
Requires:       python3-pyinotify
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 -n %{name}-0.96.0
# %setup -q -n %{name}-cd5d6d76b26db6ce8c4871ef5118f3210457077e

# Change default SendMode from "Keyboard" to "Mouse Selection"
# sed -i 's|self.sendMode = SendMode.KEYBOARD|self.sendMode = SendMode.SELECTION|g' lib/autokey/model.py

# iconv -c -t ascii -o README.rst README.rst

# can't find python modul but is installed
sed -i 's|dbus-python||g' setup.py

sed -i 's|#!/usr/bin/env python|#!/usr/bin/python3|' lib/autokey/{service,monitor,common,qtapp}.py
2to3 -w -f all -f idioms -f buffer -f set_literal .

# fix png size
#mogrify -resize 96x96! config/autokey.png

%build
python3 setup.py build

%install
python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}
%suse_update_desktop_file %{name}-qt DesktopSettings
%suse_update_desktop_file %{name}-gtk DesktopSettings
chmod +x %{buildroot}%{python3_sitelib}/%{name}/{service,monitor,common,qtapp}.py
# chmod +x %{buildroot}%{python3_sitelib}/%{name}/qtui/{recorddialog,folderpage,dialogs,detectdialog,abbrsettings,hotkeysettings,centralwidget,phrasepage,enginesettings,settingswidget,specialhotkeysettings,windowfiltersettings,generalsettings,scriptpage}.py
%fdupes %{buildroot}%{python3_sitelib}/%{name}

%post common
# enable xauth in pam
/usr/bin/sed -i 's|^#.*session.*optional.*pam_xauth.so|session  optional       pam_xauth.so|' /etc/pam.d/sudo ||:

%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/hicolor
%dir %{_datadir}/icons/hicolor/scalable
%dir %{_datadir}/icons/hicolor/scalable/apps
%dir %{_datadir}/icons/hicolor/96x96
%dir %{_datadir}/icons/hicolor/96x96/apps
%{_datadir}/icons/hicolor/scalable/apps/%{name}-status*.svg
%{_datadir}/icons/hicolor/96x96/apps/%{name}.png
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
# Do not include theme specific icons
%exclude %{_datadir}/icons/ubuntu-mono-dark/apps/*
%exclude %{_datadir}/icons/ubuntu-mono-light/apps/*
%exclude %{_datadir}/icons/Humanity/scalable/apps/*.svg
%{_bindir}/%{name}-run
%{_mandir}/man1/%{name}-run.1*
%{_bindir}/%{name}-shell
%dir %{python3_sitelib}/%{name}/__pycache__
%{python3_sitelib}/%{name}/__pycache__/*

%dir %{python3_sitelib}/%{name}/iomediator
%{python3_sitelib}/%{name}/iomediator/*
%dir %{python3_sitelib}/%{name}/iomediator/__pycache__
%{python3_sitelib}/%{name}/iomediator/__pycache__/*

%dir %{python3_sitelib}/%{name}/configmanager
%{python3_sitelib}/%{name}/configmanager/*
%dir %{python3_sitelib}/%{name}/configmanager/__pycache__
%{python3_sitelib}/%{name}/configmanager/__pycache__/*

%dir %{python3_sitelib}/%{name}/model
%{python3_sitelib}/%{name}/model/*
%dir %{python3_sitelib}/%{name}/model/__pycache__
%{python3_sitelib}/%{name}/model/__pycache__/*

%dir %{python3_sitelib}/%{name}/scripting
%{python3_sitelib}/%{name}/scripting/*
%dir %{python3_sitelib}/%{name}/scripting/__pycache__
%{python3_sitelib}/%{name}/scripting/__pycache__/*

%exclude %{python3_sitelib}/%{name}/__pycache__/gtkapp.cpython-*.pyc
%exclude %{python3_sitelib}/%{name}/__pycache__/qtapp.cpython-*.pyc

%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*

%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*

%changelog
openSUSE Build Service is sponsored by