@@ -48,7 +48,17 @@ (define-public anthy
(replace 'check
(lambda _
(with-directory-excursion "test"
- (invoke "./anthy" "--all")))))))
+ (invoke "./anthy" "--all"))))
+ (add-after 'unpack 'support-guix-anthy-home
+ (lambda _
+ ;; This is required to test ibus-anthy
+ (with-fluids ((%default-port-encoding "ISO-8859-1"))
+ (substitute* "src-diclib/conf.c"
+ (("add_val\\(\"HOME\", pw->pw_dir")
+ "char* home = getenv(\"GUIX_ANTHY_HOME\");
+if(home == NULL)
+ home = pw->pw_dir;
+add_val(\"HOME\", home"))))))))
(home-page "https://anthy.osdn.jp/")
(synopsis "Japanese input method")
(description "Anthy is a Japanese input method for converting
@@ -52,10 +52,12 @@ (define-module (gnu packages ibus)
#:use-module (gnu packages gnome)
#:use-module (gnu packages gtk)
#:use-module (gnu packages iso-codes)
+ #:use-module (gnu packages linux)
#:use-module (gnu packages logging)
#:use-module (gnu packages perl)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages python)
+ #:use-module (gnu packages python-check)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages python-web)
#:use-module (gnu packages serialization)
@@ -307,7 +309,7 @@ (define-public libpinyin
(define-public ibus-anthy
(package
(name "ibus-anthy")
- (version "1.5.9")
+ (version "1.5.14")
(source (origin
(method url-fetch)
(uri (string-append
@@ -315,7 +317,7 @@ (define-public ibus-anthy
version "/ibus-anthy-" version ".tar.gz"))
(sha256
(base32
- "1y8sf837rmp662bv6zakny0xcm7c9c5qda7f9kq9riv9ywpcbw6x"))))
+ "16vd0k8wm13s38869jqs3dnwmjvywgn0snnpyi41m28binhlssf8"))))
(build-system gnu-build-system)
(arguments
'(#:configure-flags
@@ -323,6 +325,46 @@ (define-public ibus-anthy
(list (string-append "--libexecdir=" %output "/libexec"))
#:phases
(modify-phases %standard-phases
+ (add-after 'unpack 'fix-date
+ (lambda _
+ (substitute* "data/Makefile.in"
+ ;; The test would get the current year and check if its data
+ ;; contains it. However, this will fail in the future, as
+ ;; running this test in a later year would fail.
+ ;; XXX: Future versions will have more recent years, change this
+ ;; to the most recent year in data/era.t (last line).
+ (("S_YEAR=.*;") "S_YEAR=2021;"))))
+ (add-before 'check 'pre-check
+ (lambda _
+ ;; Fix running ibus
+ (substitute* "tests/test-build.sh"
+ (("export GSETTINGS_SCHEMA_DIR=")
+ "export GSETTINGS_SCHEMA_DIR=$GSETTINGS_SCHEMA_DIR${GSETTINGS_SCHEMA_DIR:+:}")
+ (("export GI_TYPELIB_PATH=")
+ "export GI_TYPELIB_PATH=$GI_TYPELIB_PATH${GI_TYPELIB_PATH:+:}"))
+ ;; Do not wait for focus, but wait for the window to be available
+ (substitute* "tests/anthytest.py"
+ (("window =") "self.window =")
+ (("window\\.") "self.window.")
+ (("window.show_all\\(\\)")
+ "window.show_all()
+ GLib.idle_add(self.bring_to_front)
+
+ def bring_to_front(self):
+ self.window.present()"))))
+ (delete 'check)
+ (add-after 'install 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ (setenv "HOME" (getcwd))
+ (setenv "GUIX_ANTHY_HOME" (getcwd))
+ (setenv "XDG_DATA_HOME" (getcwd))
+ (setenv "XVFB_SERVER_ARGS" "+iglx -noreset")
+ (setenv "XDG_RUNTIME_DIR" (string-append (getcwd) "/runtime-dir"))
+ (mkdir-p (getenv "XDG_RUNTIME_DIR"))
+ (invoke "dbus-run-session" "--"
+ "xvfb-run" "-a" "-s" (getenv "XVFB_SERVER_ARGS")
+ "make" "check"))))
(add-after 'install 'wrap-programs
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
@@ -337,12 +379,18 @@ (define-public ibus-anthy
'("ibus-engine-anthy" "ibus-setup-anthy"))
#t))))))
(native-inputs
- `(("gettext" ,gettext-minimal)
+ `(("dbus" ,dbus)
+ ("gettext" ,gettext-minimal)
+ ("glib" ,glib "bin") ;for glib-compile-schemas, used by tests
("intltool" ,intltool)
("pkg-config" ,pkg-config)
- ("python" ,python)))
+ ("procps" ,procps)
+ ("python-pycotap" ,python-pycotap)
+ ("python-wrapper" ,python-wrapper)
+ ("util-linux" ,util-linux) ;for getopt, used by tests
+ ("xvfb-run" ,xvfb-run)))
(inputs
- (list anthy gtk+ ibus gobject-introspection python-pygobject))
+ (list anthy gdk-pixbuf gtk+ ibus gobject-introspection python-pygobject python-pycairo))
(synopsis "Anthy Japanese language input method for IBus")
(description "IBus-Anthy is an engine for the input bus \"IBus\"). It
adds the Anthy Japanese language input method to IBus. Because most graphical
@@ -2004,3 +2004,21 @@ (define-public python-xunitparser
Python objects. It tries to use the objects available in the standard
@code{unittest} module.")
(license license:expat)))
+
+(define-public python-pycotap
+ (package
+ (name "python-pycotap")
+ (version "1.2.2")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "pycotap" version))
+ (sha256
+ (base32 "1v69fxial9i5wlap6wc4igq3hydvxbak7dlgb7cikk8wjgafqf7r"))))
+ (build-system python-build-system)
+ (home-page "https://el-tramo.be/pycotap")
+ (synopsis "Tiny test runner that outputs TAP results to standard output.")
+ (description
+ "This package provides a tiny test runner that outputs TAP results to standard
+output.")
+ (license license:expat)))