anish 854742a
Name:       ibus-typing-booster
d68acbd
Version:    2.25.7
57bb38a
Release:    %autorelease
21c4582
Summary:    A completion input method
bfbaf09
License:    GPL-3.0-or-later AND Apache-2.0
f2b8879
URL:        https://mike-fabian.github.io/ibus-typing-booster/
63799b6
Source0:    https://github.com/mike-fabian/ibus-typing-booster/releases/download/%{version}/ibus-typing-booster-%{version}.tar.gz
5661846
Requires:   ibus >= 1.5.3
f2b8879
Requires:   m17n-lib
f93f84a
%{?__python3:Requires: %{__python3}}
29ab80c
Requires:   python3-dbus
229c2ad
Requires:   python3-distro
d4c49e0
# because of “from packing import version”:
d4c49e0
Requires:   python3-packaging
29ab80c
Requires:   python3-enchant
db8f8a6
Requires:   python3-pyxdg
34fda8e
%if 0%{?fedora} >= 24 || 0%{?rhel} > 7
8384956
# Recommend reasonably good fonts which have most of the emoji:
81eb6a2
Recommends: google-noto-emoji-color-fonts
cb9b44a
Recommends: gdouros-symbola-fonts
49f181f
# For better description of the dictionaries in the setup tool
49f181f
# makes it possible to search for full language and territory names
49f181f
# and not just locale codes:
3451f62
Recommends: python3-langtable
d169880
# To play a sound on error:
d169880
Recommends: python3-simpleaudio
b2796b1
# Use better regexpressions if available:
b2796b1
Recommends: python3-regex
f3f537a
# To get the currently active window in a Gnome Wayland session:
f3f537a
Recommends: python3-pyatspi
db8f8a6
%endif
34fda8e
%if 0%{?fedora} >= 26 || 0%{?rhel} > 7
d155c9f
# Save some space in the binary rpm by requiring the Fedora
d155c9f
# packages which contain the emoji data files:
d155c9f
Requires: cldr-emoji-annotation
d155c9f
Requires: unicode-ucd
d155c9f
%endif
f2b8879
BuildRequires:  ibus-devel
3775828
BuildRequires:  gcc
34fda8e
%if 0%{?fedora} >= 24 || 0%{?rhel} > 7
cafb0a8
BuildRequires:  python3-devel >= 3.6.0
d155c9f
BuildRequires:  python3-pyxdg
db8f8a6
%else
db8f8a6
BuildRequires:  python34-devel
db8f8a6
%endif
183ecd7
# for the unit tests
183ecd7
BuildRequires:  m17n-lib
183ecd7
BuildRequires:  m17n-db-extras
4fd9725
BuildRequires:  m17n-db-devel
183ecd7
BuildRequires:  python3-enchant
94545da
BuildRequires:  enchant2
6997649
BuildRequires:  hunspell-en
d4c49e0
# because of “from packing import version”:
d4c49e0
BuildRequires:   python3-packaging
d4c49e0
%if 0%{?fedora} >= 35
c7fe36c
# to make the python3-enchant test work for hunspell dictionaries which are not yet UTF-8:
c7fe36c
BuildRequires:   glibc-gconv-extra
d4c49e0
%endif
0eac733
%if 0%{?fedora} && 0%{?fedora} >= 34
8cc7790
BuildRequires:  python3-libvoikko
7c0e1d0
BuildRequires:  voikko-fi
7c0e1d0
%endif
0a3f558
BuildRequires:  appstream
0d01911
BuildRequires:  libappstream-glib
85b48a5
BuildRequires:  desktop-file-utils
85b48a5
BuildRequires:  python3-gobject
85b48a5
BuildRequires:  python3-gobject-base
183ecd7
BuildRequires:  hunspell-cs
183ecd7
BuildRequires:  hunspell-de
183ecd7
BuildRequires:  hunspell-en
183ecd7
BuildRequires:  hunspell-es
3c043a8
BuildRequires:  hunspell-fr
183ecd7
BuildRequires:  hunspell-it
183ecd7
BuildRequires:  hunspell-ko
7a82415
BuildRequires:  glib2
85b48a5
BuildRequires:  gtk3
85b48a5
BuildRequires:  dconf
85b48a5
BuildRequires:  dbus-x11
85b48a5
BuildRequires:  ibus
4d19b59
BuildRequires:  xorg-x11-server-Xvfb
4db611b
BuildRequires:  glibc-langpack-en
4db611b
BuildRequires:  glibc-langpack-cs
4db611b
BuildRequires:  glibc-langpack-km
4db611b
BuildRequires:  glibc-langpack-pt
4db611b
BuildRequires:  glibc-langpack-am
a5146d6
BuildRequires:  glibc-langpack-de
a5146d6
BuildRequires:  glibc-langpack-ar
48234ff
BuildRequires: make
a5146d6
# A window manger is needed for the GUI test
74b519a
# BuildRequires:  i3
anish 854742a
BuildArch:  noarch
11e22af
# Some test cases fail on ppc64 and s390x (because of some bugs on
11e22af
# these platforms I think).  This makes the build fail for no good
11e22af
# reason if it accidentally is build on one of these platforms.
11e22af
#
11e22af
# So even though this is a noarch package, tell koji to never build it
11e22af
# on ppc64 and s390x:
11e22af
ExcludeArch: ppc64 s390x
anish 854742a
anish 854742a
%description
21c4582
Ibus-typing-booster is a context sensitive completion
21c4582
input method to speedup typing.
anish 854742a
a5146d6
%package tests
a5146d6
Summary:        Tests for the %{name} package
a5146d6
Requires:       %{name} = %{version}-%{release}
a5146d6
a5146d6
%description tests
a5146d6
The %{name}-tests package contains tests that can be used to verify
a5146d6
the functionality of the installed %{name} package.
a5146d6
7978408
%package -n emoji-picker
7978408
Summary: An emoji selection tool
7978408
Requires: ibus-typing-booster = %{version}-%{release}
7978408
7978408
%description -n emoji-picker
7978408
A simple application to find and insert emoji and other
7978408
Unicode symbols.
7978408
anish 854742a
%prep
anish 854742a
%setup -q
anish 854742a
anish 854742a
anish 854742a
%build
29ab80c
export PYTHON=%{__python3}
1fcdcc7
%configure --disable-static --enable-installed-tests
3894d54
%make_build
anish 854742a
anish 854742a
%install 
29ab80c
export PYTHON=%{__python3}
3894d54
%make_install NO_INDEX=true  pkgconfigdir=%{_datadir}/pkgconfig
dd0d7c9
%py_byte_compile %{python3} /usr/share/ibus-typing-booster/engine
dd0d7c9
%py_byte_compile %{python3} /usr/share/ibus-typing-booster/setup
34fda8e
%if 0%{?fedora} >= 26 || 0%{?rhel} > 7
36ed560
    # These files are in the required package “cldr-emoji-annotation”
36ed560
    rm $RPM_BUILD_ROOT/%{_datadir}/%{name}/data/annotations/*.xml
36ed560
    rm $RPM_BUILD_ROOT/%{_datadir}/%{name}/data/annotationsDerived/*.xml
d2d1066
    # This file is in the required package “unicode-ucd”:
d2d1066
    rm $RPM_BUILD_ROOT/%{_datadir}/%{name}/data/UnicodeData.txt
d2d1066
    # At least emoji-data.txt emoji-sequences.txt emoji-zwj-sequences.txt
d2d1066
    # are still there even on Fedora >= 26 they are not available in any packages:
63799b6
    gzip -n --force --best $RPM_BUILD_ROOT/%{_datadir}/%{name}/data/*.txt
4a7a483
    # The json file from emojione is not deleted anymore because
4a7a483
    # the package nodejs-emojione-json has been orphaned:
63799b6
    gzip -n --force --best $RPM_BUILD_ROOT/%{_datadir}/%{name}/data/*.json
d155c9f
%else
63799b6
    gzip -n --force --best $RPM_BUILD_ROOT/%{_datadir}/%{name}/data/*.{txt,json}
63799b6
    gzip -n --force --best $RPM_BUILD_ROOT/%{_datadir}/%{name}/data/annotations/*.xml
63799b6
    gzip -n --force --best $RPM_BUILD_ROOT/%{_datadir}/%{name}/data/annotationsDerived/*.xml
d155c9f
%endif
anish 854742a
9bf6440
%find_lang %{name}
9bf6440
5661846
%check
85b48a5
export LC_ALL=C.UTF-8
0a3f558
appstreamcli validate --pedantic --no-net %{buildroot}/%{_datadir}/metainfo/*.appdata.xml
0a3f558
# According to the appstream developers, appstream-util is unmaintained:
0a3f558
# https://github.com/ximion/appstream/issues/494#issuecomment-1521419742
0a3f558
# But I keep it here for the time being because the Fedora packaging guidelines ask for it:
0a3f558
# https://docs.fedoraproject.org/en-US/packaging-guidelines/AppData/#_app_data_validate_usage
0d01911
appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/metainfo/*.appdata.xml
5661846
desktop-file-validate \
5661846
    $RPM_BUILD_ROOT%{_datadir}/applications/ibus-setup-typing-booster.desktop
3c78a0b
desktop-file-validate \
3c78a0b
    $RPM_BUILD_ROOT%{_datadir}/applications/emoji-picker.desktop
6b58144
pushd engine
183ecd7
    # run doctests
5220d01
    # commented out because of https://bugzilla.redhat.com/show_bug.cgi?id=2218460
5220d01
    #python3 hunspell_suggest.py
5220d01
    #python3 m17n_translit.py
5220d01
    #python3 itb_emoji.py
5220d01
    #python3 itb_util.py
6b58144
popd
7a82415
mkdir -p /tmp/glib-2.0/schemas/
7a82415
cp org.freedesktop.ibus.engine.typing-booster.gschema.xml \
7a82415
   /tmp/glib-2.0/schemas/org.freedesktop.ibus.engine.typing-booster.gschema.xml
7a82415
glib-compile-schemas /tmp/glib-2.0/schemas #&>/dev/null || :
3de9aa1
export XDG_DATA_DIRS=/tmp:%{_datadir} # /usr/share is needed to make enchant2 work!
183ecd7
eval $(dbus-launch --sh-syntax)
183ecd7
dconf dump /
7a82415
dconf write /org/freedesktop/ibus/engine/typing-booster/offtherecord false
7a82415
dconf write /org/freedesktop/ibus/engine/typing-booster/usedigitsasselectkeys true
3e2189b
dconf write /org/freedesktop/ibus/engine/typing-booster/addspaceoncommit true
7a82415
dconf write /org/freedesktop/ibus/engine/typing-booster/tabenable false
bc38098
dconf write /org/freedesktop/ibus/engine/typing-booster/inputmethod "'NoIME'"
7a82415
dconf write /org/freedesktop/ibus/engine/typing-booster/rememberlastusedpreeditime true
7a82415
dconf write /org/freedesktop/ibus/engine/typing-booster/mincharcomplete 1
7a82415
dconf write /org/freedesktop/ibus/engine/typing-booster/dictionary "'en_US'"
7a82415
dconf write /org/freedesktop/ibus/engine/typing-booster/emojipredictions true
7a82415
dconf write /org/freedesktop/ibus/engine/typing-booster/autocommitcharacters "''"
7a82415
dconf write /org/freedesktop/ibus/engine/typing-booster/pagesize 6
7a82415
dconf write /org/freedesktop/ibus/engine/typing-booster/shownumberofcandidates true
7a82415
dconf write /org/freedesktop/ibus/engine/typing-booster/showstatusinfoinaux true
61ab110
dconf write /org/freedesktop/ibus/engine/typing-booster/inlinecompletion false
897926d
dconf write /org/freedesktop/ibus/engine/typing-booster/keybindings "{'next_input_method': <['Control+Down', 'Control+KP_Down']>, 'previous_input_method': <['Control+Up', 'Control+KP_Up']>, 'lookup_related': <['Mod5+F12']>, 'enable_lookup': <['Tab', 'ISO_Left_Tab', 'KP_Divide']>, 'select_next_candidate': <['Tab', 'ISO_Left_Tab', 'Down', 'KP_Down']>, 'lookup_table_page_down': <['Page_Down', 'KP_Page_Down', 'KP_Next']>, 'toggle_emoji_prediction': <['Mod5+F6']>, 'lookup_table_page_up': <['Page_Up', 'KP_Page_Up', 'KP_Prior']>, 'toggle_off_the_record': <['Mod5+F9']>, 'cancel': <['Escape']>, 'setup': <['Mod5+F10']>, 'select_previous_candidate': <['Shift+Tab', 'Shift+ISO_Left_Tab', 'Up', 'KP_Up']>}"
183ecd7
dconf dump /
4d19b59
export DISPLAY=:1
4d19b59
Xvfb $DISPLAY -screen 0 1024x768x16 &
5f7dcf5
# A window manager and and ibus-daemon are needed to run the GUI
5f7dcf5
# test tests/test_gtk.py, for example i3 can be used.
5f7dcf5
#
5f7dcf5
# To debug what is going on if there is a problem with the GUI test
5f7dcf5
# add BuildRequires: x11vnc and start a vnc server:
5f7dcf5
#
5f7dcf5
#     x11vnc -display $DISPLAY -unixsock /tmp/mysock -bg -nopw -listen localhost -xkb
5f7dcf5
#
5f7dcf5
# Then one can view what is going on outside of the chroot with vncviewer:
5f7dcf5
#
5f7dcf5
#     vncviewer /var/lib/mock/fedora-32-x86_64/root/tmp/mysock
5f7dcf5
#
5f7dcf5
# The GUI test will be skipped if XDG_SESSION_TYPE is not x11 or wayland.
5f7dcf5
#
5f7dcf5
#ibus-daemon -drx
5f7dcf5
#touch /tmp/i3config
5f7dcf5
#i3 -c /tmp/i3config &
5f7dcf5
#export XDG_SESSION_TYPE=x11
5f7dcf5
5f7dcf5
make check && rc=0 || rc=1
5f7dcf5
cat tests/*.log
5f7dcf5
if [ $rc != 0 ] ; then
5f7dcf5
    exit $rc
5f7dcf5
fi
5661846
9bf6440
%files -f %{name}.lang
31278fa
%doc AUTHORS COPYING README README.html README.md
anish 854742a
%{_datadir}/%{name}
3c78a0b
%{_datadir}/metainfo/typing-booster.appdata.xml
anish 854742a
%{_datadir}/ibus/component/typing-booster.xml
0aa0bae
%{_datadir}/icons/hicolor/16x16/apps/ibus-typing-booster.png
0aa0bae
%{_datadir}/icons/hicolor/22x22/apps/ibus-typing-booster.png
0aa0bae
%{_datadir}/icons/hicolor/32x32/apps/ibus-typing-booster.png
0aa0bae
%{_datadir}/icons/hicolor/48x48/apps/ibus-typing-booster.png
0aa0bae
%{_datadir}/icons/hicolor/64x64/apps/ibus-typing-booster.png
0aa0bae
%{_datadir}/icons/hicolor/128x128/apps/ibus-typing-booster.png
0aa0bae
%{_datadir}/icons/hicolor/256x256/apps/ibus-typing-booster.png
0aa0bae
%{_datadir}/icons/hicolor/scalable/apps/ibus-typing-booster.svg
anish 854742a
%{_libexecdir}/ibus-engine-typing-booster
anish 854742a
%{_libexecdir}/ibus-setup-typing-booster
7978408
%{_datadir}/applications/ibus-setup-typing-booster.desktop
98a61f3
%{_datadir}/glib-2.0/schemas/org.freedesktop.ibus.engine.typing-booster.gschema.xml
7978408
a5146d6
%files tests
a5146d6
%dir %{_libexecdir}/installed-tests
a5146d6
%{_libexecdir}/installed-tests/%{name}
a5146d6
%dir %{_datadir}/installed-tests
a5146d6
%{_datadir}/installed-tests/%{name}
a5146d6
7978408
%files -n emoji-picker
7978408
%{_bindir}/emoji-picker
242b429
%{_datadir}/metainfo/emoji-picker.appdata.xml
7978408
%{_datadir}/applications/emoji-picker.desktop
7978408
anish 854742a
%changelog
57bb38a
%autochangelog