GNU bug report logs - #70884
[PATCH 0/2] Package qutebrowser spellcheck files.

Previous Next

Package: guix-patches;

Reported by: Herman Rimm <herman <at> rimm.ee>

Date: Sat, 11 May 2024 19:52:01 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 70884 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#70884; Package guix-patches. (Sat, 11 May 2024 19:52:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Herman Rimm <herman <at> rimm.ee>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sat, 11 May 2024 19:52:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: guix-patches <at> gnu.org
Subject: [PATCH 0/2] Package qutebrowser spellcheck files.
Date: Sat, 11 May 2024 21:51:39 +0200
Hello,

The first patch packages .bdic files built from the hunspell .dic and
.aff files. In the second one qutebrowser is patched to instruct users
to install those files if missing, instead of downloading them from a
Chromium Project repository with the dictcli.py script.

Cheers,
Herman

Herman Rimm (2):
  gnu: Add hunspell-bdic-en*.
  gnu: qutebrowser: Warn about missing .bdic files and ignore version.

 gnu/packages/hunspell.scm     | 82 +++++++++++++++++++++++++++++++++++
 gnu/packages/web-browsers.scm | 16 +++++++
 2 files changed, 98 insertions(+)


base-commit: 360fea15cb25d0cdf55ec55488956257a0219fe4
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#70884; Package guix-patches. (Sat, 11 May 2024 19:59:02 GMT) Full text and rfc822 format available.

Message #8 received at 70884 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70884 <at> debbugs.gnu.org
Subject: [PATCH 1/2] gnu: Add hunspell-bdic-en*.
Date: Sat, 11 May 2024 21:57:52 +0200
* gnu/packages/aspell.scm (aspell-compiled-word-list): New procedure.
(define-compiled-word-list-dictionary): New macro.
(hunspell-bdic-en, hunspell-bdic-en-au, hunspell-bdic-en-ca,
hunspell-bdic-en-gb, hunspell-bdic-en-gb-ize, hunspell-bdic-en-us): New
variables.

Change-Id: I4f02295add9803aefe7687b11d2bcbcb21cdd6b1
---
 gnu/packages/hunspell.scm | 82 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 82 insertions(+)

diff --git a/gnu/packages/hunspell.scm b/gnu/packages/hunspell.scm
index 7163358260..782292c79f 100644
--- a/gnu/packages/hunspell.scm
+++ b/gnu/packages/hunspell.scm
@@ -32,6 +32,7 @@ (define-module (gnu packages hunspell)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages m4)
   #:use-module (gnu packages perl)
+  #:use-module (gnu packages qt)
   #:use-module (gnu packages textutils))
 
 (define-public hunspell
@@ -445,3 +446,84 @@ (define-word-list-dictionary hunspell-dict-en-us
   "en_US"
   (synopsis "Hunspell dictionary for United States English"))
 
+(define* (aspell-compiled-word-list
+           language
+           synopsis
+           #:optional
+           (nick (string-map (lambda (chr)
+                               (if (char=? #\_ chr)
+                                   #\-
+                                   chr))
+                             (string-downcase language))))
+  (package
+    (inherit (aspell-word-list language synopsis nick))
+    (name (string-append "hunspell-bdic-" nick))
+    (version "2018.04.16")
+    (native-inputs
+     (list (aspell-word-list language synopsis nick) qtwebengine))
+    (build-system trivial-build-system)
+    (arguments
+     `(#:modules ((guix build utils))
+       #:builder
+       (begin
+         (use-modules (guix build utils))
+         (let ((dictionary
+                (string-append
+                  (assoc-ref %build-inputs
+                             (string-append "hunspell-dict-" ,nick))
+                  "/share/hunspell/" ,language ".dic"))
+               (convert-dict
+                (string-append
+                  (assoc-ref %build-inputs "qtwebengine")
+                  "/lib/qt6/libexec/qwebengine_convert_dict"))
+               (qtwebengine-dictionaries
+                 (string-append %output
+                                "/share/qtwebengine_dictionaries"))
+               (bdic (string-append (string-map (lambda (chr)
+                                                  (if (char=? #\_ chr)
+                                                      #\-
+                                                      chr))
+                                                ,language)
+                                    ".bdic")))
+           (invoke convert-dict dictionary bdic)
+           (install-file bdic qtwebengine-dictionaries)
+           #t))))
+    (description
+     "This package provides a compiled dictionary for the Hunspell
+spell-checking library.")))
+
+(define-syntax define-compiled-word-list-dictionary
+  (syntax-rules (synopsis)
+    ((_ name language (synopsis text))
+     (define-public name
+       (aspell-compiled-word-list language text)))
+    ((_ name language nick (synopsis text))
+     (define-public name
+       (aspell-compiled-word-list language text nick)))))
+
+(define-compiled-word-list-dictionary hunspell-bdic-en
+  "en"
+  (synopsis "Compiled Hunspell dictionary for English"))
+
+(define-compiled-word-list-dictionary hunspell-bdic-en-au
+  "en_AU"
+  (synopsis "Compiled Hunspell dictionary for Australian English"))
+
+(define-compiled-word-list-dictionary hunspell-bdic-en-ca
+  "en_CA"
+  (synopsis "Compiled Hunspell dictionary for Canadian English"))
+
+(define-compiled-word-list-dictionary hunspell-bdic-en-gb
+  "en_GB-ise" "en-gb"
+  (synopsis
+    "Compiled Hunspell dictionary for British English, with -ise endings"))
+
+(define-compiled-word-list-dictionary hunspell-bdic-en-gb-ize
+  "en_GB-ize"
+  (synopsis
+    "Compiled Hunspell dictionary for British English, with -ize endings"))
+
+(define-compiled-word-list-dictionary hunspell-bdic-en-us
+  "en_US"
+  (synopsis "Compiled Hunspell dictionary for United States English"))
+
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#70884; Package guix-patches. (Sat, 11 May 2024 19:59:02 GMT) Full text and rfc822 format available.

Message #11 received at 70884 <at> debbugs.gnu.org (full text, mbox):

From: Herman Rimm <herman <at> rimm.ee>
To: 70884 <at> debbugs.gnu.org
Subject: [PATCH 2/2] gnu: qutebrowser: Warn about missing .bdic files and
 ignore version.
Date: Sat, 11 May 2024 21:57:53 +0200
* gnu/packages/web.browsers.scm (qutebrowser): Add build phase.

Change-Id: Ib33c69ca4c95329c82edf9c7a6436ec9a1a0f7a7
---
 gnu/packages/web-browsers.scm | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/gnu/packages/web-browsers.scm b/gnu/packages/web-browsers.scm
index 78227a84fb..fe28f0c149 100644
--- a/gnu/packages/web-browsers.scm
+++ b/gnu/packages/web-browsers.scm
@@ -511,6 +511,22 @@ (define-public qutebrowser
                 (string-append "os.path.join(\""
                                (assoc-ref outputs "out")
                                "\", \"share\", \"qutebrowser\"")))))
+         (add-after 'unpack 'adjust-dictionary-warning-and-parsing
+           (lambda _
+             (substitute* "qutebrowser/browser/webengine/webenginesettings.py"
+               (("- see")
+                "- install hunspell-bdic-{} package files to")
+               (("scripts/dictcli.py in qutebrowser's ")
+                "{}/qutebrowser/qtwebengine_dictionaries")
+               (("\"sources\".format\\(code")
+                ".format(code, code.lower(), os.getenv('XDG_DATA_HOME')"))
+             (substitute* "qutebrowser/browser/webengine/spell.py"
+               (("for matching_dict in matching_dicts")
+                "if False")
+               (("filename for version, filename")
+                "os.path.basename(dict) for dict")
+               (("in sorted\\(versioned_dicts.*")
+                "in matching_dicts]"))))
          (add-before 'check 'set-env-offscreen
            (lambda _
              (setenv "QT_QPA_PLATFORM" "offscreen")))
-- 
2.41.0





This bug report was last modified 21 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.