[PATCH 03/20] gnu: Add python2-tegaki-wagomu.

  • Done
  • quality assurance status badge
Details
One participant
  • Alex Vong
Owner
unassigned
Submitted by
Alex Vong
Severity
normal
A
A
Alex Vong wrote on 20 Aug 2019 17:41
(address . guix-patches@gnu.org)
86zhk3vo7g.fsf@gmail.com
From e129c467a7bffd9d304ccf86e0eb317baf1043b7 Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995@gmail.com>
Date: Thu, 8 Aug 2019 13:42:46 +0800
Subject: [PATCH 03/20] gnu: Add python2-tegaki-wagomu.

* gnu/packages/language.scm
(python2-tegaki-wagomu, remove-pre-compiled-files-modules): New variables.
(remove-pre-compiled-files, tegaki-release-uri): New procedures.
---
gnu/packages/language.scm | 75 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 74 insertions(+), 1 deletion(-)

Toggle diff (104 lines)
diff --git a/gnu/packages/language.scm b/gnu/packages/language.scm
index 73376feecb..cc685437c9 100644
--- a/gnu/packages/language.scm
+++ b/gnu/packages/language.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2015, 2016 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2018 ng0 <ng0@n0.is>
+;;; Copyright © 2019 Alex Vong <alexvong1995@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -20,12 +21,17 @@
(define-module (gnu packages language)
#:use-module (gnu packages)
+ #:use-module (gnu packages glib)
#:use-module (gnu packages perl)
+ #:use-module (gnu packages pkg-config)
+ #:use-module (gnu packages python)
#:use-module (gnu packages perl-check)
+ #:use-module (gnu packages swig)
#:use-module (gnu packages web)
#:use-module (guix packages)
#:use-module (guix build-system perl)
- #:use-module ((guix licenses) #:select (gpl2 gpl3 perl-license))
+ #:use-module (guix build-system python)
+ #:use-module ((guix licenses) #:select (gpl2 gpl2+ gpl3 perl-license))
#:use-module (guix download))
(define-public perl-lingua-en-findnumber
@@ -406,3 +412,70 @@ string can be easily inferred by a human just by reading the identifier.")
(description "This module is a rather incomplete implementation of work
done by Gudrun Putze-Meier.")
(license perl-license)))
+
+(define* (tegaki-release-uri proj version
+ #:optional (ext "tar.gz"))
+ (string-append "https://github.com/tegaki/tegaki/releases/download"
+ "/v" version "/" proj "-" version "." ext))
+
+(define remove-pre-compiled-files
+ (lambda exts
+ "Return snippet for removing pre-compiled files matching one of the
+extensions in EXTS."
+ `(begin (for-each delete-file
+ (find-files "."
+ (lambda (name _)
+ (any (cut string-suffix? <> name)
+ (map (cut string-append "." <>)
+ ',exts)))))
+ #t)))
+
+;;; modules required for the above snippet
+(define remove-pre-compiled-files-modules
+ '((guix build utils)
+ (srfi srfi-1)
+ (srfi srfi-26)))
+
+(define-public python2-tegaki-wagomu
+ (package
+ (name "python2-tegaki-wagomu")
+ (version "0.3.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (tegaki-release-uri "tegaki-wagomu" version))
+ (sha256
+ (base32
+ "1pzdiq4zy1nyylaj9i6v2h4h0r05klahskzpafpp367p4rysi1x9"))
+ (modules remove-pre-compiled-files-modules)
+ (snippet (remove-pre-compiled-files "pyc"))))
+ (build-system python-build-system)
+ (arguments
+ `(#:python ,python-2 ; only Python 2 is supported
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'fix-recognizer
+ (lambda* (#:key inputs #:allow-other-keys)
+ ;; fix missing module and function
+ (substitute* "tegakiwagomu.py"
+ (("import Results,")
+ "import ")
+ (("def _recognize")
+ "def recognize")
+ (("Results\\(candidates\\)")
+ "candidates"))
+ #t)))))
+ (inputs
+ `(("glib" ,glib)))
+ (native-inputs
+ `(("pkg-config" ,pkg-config)
+ ("swig" ,swig)))
+ (home-page "https://tegaki.github.io/")
+ (synopsis
+ "Chinese and Japanese Handwriting Recognition (Recognition engine)")
+ (description
+ "Tegaki is an ongoing project which aims to develop a free and open-source
+modern implementation of handwriting recognition software, specifically
+designed for Chinese (simplified and traditional) and Japanese, and that is
+suitable for both the desktop and mobile devices.")
+ (license gpl2+))) ; all files
--
2.22.0
-----BEGIN PGP SIGNATURE-----

iHUEARYIAB0WIQQwb8uPLAHCXSnTBVZh71Au9gJS8gUCXVwUswAKCRBh71Au9gJS
8qTGAP9Or/HHbdy2fLc2SnappLD4RyygQZBnmecIyONHoVsk5gEAu7PIaKnYAgqy
1smVCaY+81kNbJE2eb6yPEBu+cvXRAk=
=XACZ
-----END PGP SIGNATURE-----

A
A
Alex Vong wrote on 20 Aug 2019 18:21
Close all erroneously created bugs
(address . control@debbugs.gnu.org)
8636hvvmd6.fsf@gmail.com
# Close all erroneously created bugs
# Sorry for the noise!
close 37100
close 37101
close 37102
close 37103
close 37104
close 37105
close 37106
close 37107
close 37108
close 37109
close 37110
close 37111
close 37112
close 37113
close 37114
close 37115
close 37117
close 37118
close 37119
thanks
-----BEGIN PGP SIGNATURE-----

iHUEARYIAB0WIQQwb8uPLAHCXSnTBVZh71Au9gJS8gUCXVweBQAKCRBh71Au9gJS
8iX/AQDvrrIjhGRhbjTLLI9GC1Da+T+Etd+cPADjUlCs2NeI5QD9F8qny/MUgmkr
6uoW0LvoKzh6JyP4FRboLw7mLxUrDwc=
=Pm3m
-----END PGP SIGNATURE-----

?