ibus-anthy/ibus-anthy-HEAD.patch

332 lines
11 KiB
Diff
Raw Normal View History

2024-01-31 03:02:43 +00:00
From b279e156ea219833af7515ffa588c82889a1fa73 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Wed, 23 Aug 2023 11:17:02 +0900
Subject: [PATCH 1/2] test-build.sh: Fix pycotap detection
* tests/test-build.sh (init_environment): Extract pycotap checks to...
(maybe_install_pycotap): ... this new procedure. Test if it runs
successfully directly instead of looking into the Python --user-site.
BUG=https://github.com/ibus/ibus-anthy/pull/35
---
tests/test-build.sh | 37 ++++++++++++++++++++++---------------
1 file changed, 22 insertions(+), 15 deletions(-)
diff --git a/tests/test-build.sh b/tests/test-build.sh
index e83b78f..bbfa7e1 100755
--- a/tests/test-build.sh
+++ b/tests/test-build.sh
@@ -63,26 +63,33 @@ parse_args()
done;
}
+maybe_install_pycotap() {
+ # Red Hat specific hint.
+ if test -f /etc/redhat-release ; then
+ if ! rpm -q --quiet python3-pycotap; then
+ echo "Please install python3-pycotap"
+ exit -1
+ fi
+ fi;
+
+ # Check if pycotap is already available.
+ if ! python3 -m pycotap >/dev/null; then
+ echo "pycotap not found; installing via pip"
+ if ! pip install pycotap --user; then
+ echo "failed to install pycotap"
+ exit -1
+ fi
+ fi
+}
+
init_environment()
{
if test x$FORCE_TEST != x ; then
RUN_ARGS="$RUN_ARGS --force";
fi;
- HAS_TAP=0;
- if test -f /etc/redhat-release ; then
- rpm -q --quiet python3-pycotap
- if test $? -ne 0 ; then
- echo "Not found python3-pycotap";
- exit -1;
- fi;
- HAS_TAP=1;
- fi;
- TAP_DIR=`python -m site --user-site`/pycotap;
- if test $HAS_TAP -ne 1 && \
- test x"$TAP_DIR" != x && test ! -d "$TAP_DIR" ; then
- echo "pip install pycotap --user";
- pip install pycotap --user;
- fi;
+
+ maybe_install_pycotap
+
if test ! -f $BUILDDIR/../data/$ANTHY_SCHEMA_FILE ; then
echo "Not found $BUILDDIR/../data/$ANTHY_SCHEMA_FILE";
exit -1;
--
2.43.0
From 678e1f0f03fe2361153e58930b5339f5a04fcc70 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Wed, 23 Aug 2023 11:27:16 +0900
Subject: [PATCH 2/2] tests: Run ibus-daemon without panel
ibus-panel package has been separated since Fedora 39 and this test
does not need ibus-panel.
Also checks pip3.
---
tests/test-build.sh | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/tests/test-build.sh b/tests/test-build.sh
index bbfa7e1..78c8e04 100755
--- a/tests/test-build.sh
+++ b/tests/test-build.sh
@@ -74,8 +74,12 @@ maybe_install_pycotap() {
# Check if pycotap is already available.
if ! python3 -m pycotap >/dev/null; then
- echo "pycotap not found; installing via pip"
- if ! pip install pycotap --user; then
+ PIP=pip3
+ if ! command -v $PIP &> /dev/null ; then
+ PIP=pip
+ fi
+ echo "pycotap not found; installing via $PIP"
+ if ! $PIP install pycotap --user; then
echo "failed to install pycotap"
exit -1
fi
@@ -118,7 +122,7 @@ init_environment()
run_ibus_daemon()
{
- ibus-daemon --daemonize --verbose;
+ ibus-daemon --daemonize --verbose --panel disable;
sleep 1;
SUSER=`echo "$USER" | cut -c 1-7`;
ps -ef | grep "$SUSER" | grep ibus | grep -v grep;
--
2.43.0
From 137f5d7b0eff9a6e631685a567d06b992146e362 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Thu, 7 Sep 2023 12:57:47 +0900
Subject: [PATCH] engine: Fix to commit selected candidate with OSK
Updating preedit after clicking a candidate on IBus candidate window
has an idle time so committing the preedit has to wait for the idle time.
BUG=rhbz#2237374
---
engine/python2/engine.py | 9 ++++++++-
engine/python3/engine.py | 9 ++++++++-
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/engine/python2/engine.py b/engine/python2/engine.py
index 80cfa86..42d4dc1 100644
--- a/engine/python2/engine.py
+++ b/engine/python2/engine.py
@@ -154,6 +154,7 @@ class Engine(IBus.EngineSimple):
# IBus lookup window prior to the preedit and selecting a candidate
# causes the commmit instead of the selection.
self.__osk_mode = False
+ self.__selected_preedit_commit = False
if hasattr(IBus, 'InputPurpose'):
self.__has_input_purpose = True
try:
@@ -812,7 +813,10 @@ class Engine(IBus.EngineSimple):
prev_cursor_pos = self.__cursor_pos
self.__on_key_number(keyval)
if self.__osk_mode and prev_cursor_pos == self.__cursor_pos:
- self.__on_key_return()
+ if self.__idle_id != 0:
+ self.__selected_preedit_commit = True
+ else:
+ self.__on_key_return()
def __commit_string(self, text):
self.__reset()
@@ -1328,6 +1332,9 @@ class Engine(IBus.EngineSimple):
else:
self.__update_convert_chars()
self.__idle_id = 0
+ if self.__osk_mode and self.__selected_preedit_commit:
+ self.__on_key_return()
+ self.__selected_preedit_commit = False
def __on_key_return(self):
if self.__preedit_ja_string.is_empty():
diff --git a/engine/python3/engine.py b/engine/python3/engine.py
index 7c0d283..4b50a01 100644
--- a/engine/python3/engine.py
+++ b/engine/python3/engine.py
@@ -155,6 +155,7 @@ class Engine(IBus.EngineSimple):
# IBus lookup window prior to the preedit and selecting a candidate
# causes the commmit instead of the selection.
self.__osk_mode = False
+ self.__selected_preedit_commit = False
if hasattr(IBus, 'InputPurpose'):
self.__has_input_purpose = True
try:
@@ -807,7 +808,10 @@ class Engine(IBus.EngineSimple):
prev_cursor_pos = self.__cursor_pos
self.__on_key_number(keyval)
if self.__osk_mode and prev_cursor_pos == self.__cursor_pos:
- self.__on_key_return()
+ if self.__idle_id != 0:
+ self.__selected_preedit_commit = True
+ else:
+ self.__on_key_return()
def __commit_string(self, text):
self.__reset()
@@ -1323,6 +1327,9 @@ class Engine(IBus.EngineSimple):
else:
self.__update_convert_chars()
self.__idle_id = 0
+ if self.__osk_mode and self.__selected_preedit_commit:
+ self.__on_key_return()
+ self.__selected_preedit_commit = False
def __on_key_return(self):
if self.__preedit_ja_string.is_empty():
--
2.41.0
From 0cb7776994fadb4a4edf3259133bb40e7db31936 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Tue, 30 Jan 2024 11:47:51 +0900
Subject: [PATCH] data: Update era.t with 2024
---
data/era.t | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/data/era.t b/data/era.t
index 7f7bd1b..8750bc5 100644
--- a/data/era.t
+++ b/data/era.t
@@ -2,7 +2,7 @@
#
# ibus-anthy - The Anthy engine for IBus
#
-# Copyright (c) 2010-2023 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2010-2024 Takao Fujiwara <takao.fujiwara1@gmail.com>
# Copyright (c) 2010-2013 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
@@ -342,6 +342,8 @@
れいわ4 #T35*500 2022
れいわ5 #T35*500 令和5
れいわ5 #T35*500 2023
+れいわ6 #T35*500 令和6
+れいわ6 #T35*500 2024
#T35*500 明治1
#T35*500 明治2
#T35*500 明治3
@@ -502,3 +504,4 @@
#T35*500 令和3
#T35*500 令和4
#T35*500 令和5
+ #T35*500 令和6
--
2.43.0
2024-01-31 03:02:43 +00:00
From 16ba437ea9e72685f9ac3bce7000c4e9b4bd2e7b Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Wed, 31 Jan 2024 10:44:48 +0900
Subject: [PATCH] tests: Fix make check with GitHub action
The test scripts invoke anthytest.py whose unittest can skip tests
unless Display is available and the return value has been changed
since Python 3.12.1
No pycotap.__main__ and cannot be directly executed with `-m` option.
Fedora 39 Docker does not provide USER environment variable.
Fixes: https://github.com/ibus/ibus-anthy/commit/b279e15
---
tests/test-build.sh | 14 ++++++++++----
tests/test-console.sh | 8 ++++++--
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/tests/test-build.sh b/tests/test-build.sh
index 78c8e04..4f6a5f7 100755
--- a/tests/test-build.sh
+++ b/tests/test-build.sh
@@ -28,6 +28,8 @@ ANTHY_SCHEMA_FILE=org.freedesktop.ibus.engine.anthy.gschema.xml;
SCHEMA_TMPDIR="";
FORCE_TEST="";
RUN_ARGS="";
+# Fedora 39 Docker does not provide USER
+USER=${USER:-`id | sed -e "s/uid=[0-9]*(\([^)]*\)).*/\1/"`};
usage()
{
@@ -73,7 +75,8 @@ maybe_install_pycotap() {
fi;
# Check if pycotap is already available.
- if ! python3 -m pycotap >/dev/null; then
+ # No pycotap.__main__ and cannot be directly executed with `-m` option
+ if ! python3 -c "import pycotap"; then
PIP=pip3
if ! command -v $PIP &> /dev/null ; then
PIP=pip
@@ -122,7 +125,8 @@ init_environment()
run_ibus_daemon()
{
- ibus-daemon --daemonize --verbose --panel disable;
+ # this script can run without Display
+ ibus-daemon --daemonize --verbose --panel disable --emoji-extension disable;
sleep 1;
SUSER=`echo "$USER" | cut -c 1-7`;
ps -ef | grep "$SUSER" | grep ibus | grep -v grep;
@@ -141,8 +145,10 @@ run_test_suite()
env IBUS_ANTHY_ENGINE_PATH=$SRCDIR/../engine/python$i \
IBUS_ANTHY_SETUP_PATH=$SRCDIR/../setup/python$i \
python$i -u $SRCDIR/anthytest.py $RUN_ARGS;
- if test $? -ne 0 ; then
- exit -1;
+ RETVAL=$?
+ # Return 5 with "NO TESTS RAN" in unittest/runner.py since python 3.12.1
+ if test $RETVAL -ne 0 && test $RETVAL -ne 5; then
+ exit 1;
fi;
if test x$FORCE_TEST = x ; then
rm -r $HOME/.anthy;
diff --git a/tests/test-console.sh b/tests/test-console.sh
index 374afa8..0116ae2 100755
--- a/tests/test-console.sh
+++ b/tests/test-console.sh
@@ -34,6 +34,8 @@ PID_XORG=0;
PID_GNOME_SESSION=0;
FORCE_TEST="";
RUN_ARGS="--exit";
+# Fedora 39 Docker does not provide USER
+USER=${USER:-`id | sed -e "s/uid=[0-9]*(\([^)]*\)).*/\1/"`};
usage()
{
@@ -152,8 +154,10 @@ run_test_suite()
echo "#### Starting $PYTHON API test $RUN_ARGS";
export GTK_IM_MODULE=ibus
$PYTHON -u $SRCDIR/anthytest.py $RUN_ARGS;
- if test $? -ne 0 ; then
- exit -1;
+ RETVAL=$?
+ # Return 5 with "NO TESTS RAN" in unittest/runner.py since python 3.12.1
+ if test $RETVAL -ne 0 && test $RETVAL -ne 5; then
+ exit 1;
fi;
if test x$FORCE_TEST = x ; then
for ANTHY_CONFIG in ".anthy" ".config/anthy" ; do
--
2.43.0