GNU bug report logs - #46512
[PATCH]: gnu: opencc: Update to 1.1.1.

Previous Next

Package: guix-patches;

Reported by: Zhu Zihao <all_but_last <at> 163.com>

Date: Sun, 14 Feb 2021 16:25:02 UTC

Severity: normal

Tags: patch

Done: Zhu Zihao <all_but_last <at> 163.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 46512 in the body.
You can then email your comments to 46512 AT debbugs.gnu.org in the normal way.

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#46512; Package guix-patches. (Sun, 14 Feb 2021 16:25:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Zhu Zihao <all_but_last <at> 163.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sun, 14 Feb 2021 16:25:02 GMT) Full text and rfc822 format available.

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

From: Zhu Zihao <all_but_last <at> 163.com>
To: guix-patches <at> gnu.org
Subject: [PATCH]: gnu: opencc: Update to 1.1.1.
Date: Mon, 15 Feb 2021 00:23:37 +0800
[Message part 1 (text/plain, inline)]
This patch update opencc to 1.1.1 and add the python binding build for
it.

[signature.asc (application/pgp-signature, inline)]
[0001-gnu-opencc-Update-to-1.1.1.patch (text/x-patch, inline)]
From bcb056a18920c8e7eb33b1735e4e7cf5499fc2e9 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last <at> 163.com>
Date: Sun, 14 Feb 2021 21:52:35 +0800
Subject: [PATCH] gnu: opencc: Update to 1.1.1.

* gnu/packages/textutils.scm(opencc): Update to 1.1.1

[source]<patches>: Add new patch.

[arguments]<out-of-source?>: Build in source tree.
<parallel-build?>: Disable.
<phases>: In "patch-3rd-party-references", fix the version of dependency.
Add phases "patch-python-binding-installation", "install-python-binding"
and "enable-bytecode-determinism".

[native-inputs]: Add python-setuptools and python-wheel.

* gnu/packages/patches/opencc-py-binding-dont-rebuild.patch: New file.
* gnu/local.mk(dist_patch_DATA): Add new entry.
---
 gnu/local.mk                                  |  1 +
 .../opencc-py-binding-dont-rebuild.patch      | 13 +++++
 gnu/packages/textutils.scm                    | 58 ++++++++++++++++---
 3 files changed, 63 insertions(+), 9 deletions(-)
 create mode 100644 gnu/packages/patches/opencc-py-binding-dont-rebuild.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 7b6cd8e0ae..9d9d394d84 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1419,6 +1419,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/omake-fix-non-determinism.patch	\
   %D%/packages/patches/openbabel-fix-crash-on-nwchem-output.patch	\
   %D%/packages/patches/opencascade-oce-glibc-2.26.patch		\
+  %D%/packages/patches/opencc-py-binding-dont-rebuild.patch	\
   %D%/packages/patches/opencv-fix-build-of-grfmt_jpeg2000.cpp.patch	\
   %D%/packages/patches/opencv-rgbd-aarch64-test-fix.patch	\
   %D%/packages/patches/opendht-fix-jami.patch			\
diff --git a/gnu/packages/patches/opencc-py-binding-dont-rebuild.patch b/gnu/packages/patches/opencc-py-binding-dont-rebuild.patch
new file mode 100644
index 0000000000..d1140489db
--- /dev/null
+++ b/gnu/packages/patches/opencc-py-binding-dont-rebuild.patch
@@ -0,0 +1,13 @@
+This patch prevents the rebuild of OpenCC while installing the python binding.
+
+Author: Zhu Zihao <all_but_last <at> 163.com>
+--- a/python/setup.py
++++ b/python/setup.py
+@@ -195,7 +195,6 @@
+         'clib/share/opencc/*',
+     ]},
+     cmdclass={
+-        'build_py': BuildPyCommand,
+         'bdist_wheel': BDistWheelCommand
+     },
+ 
diff --git a/gnu/packages/textutils.scm b/gnu/packages/textutils.scm
index 34da04d0d8..e10cfd5615 100644
--- a/gnu/packages/textutils.scm
+++ b/gnu/packages/textutils.scm
@@ -60,6 +60,7 @@
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages python-build)
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages slang)
@@ -1051,36 +1052,75 @@ OpenDocument presentations (*.odp).")
 (define-public opencc
   (package
     (name "opencc")
-    (version "1.0.5")
+    (version "1.1.1")
     (source
      (origin
        (method git-fetch)
        (uri (git-reference
-              (url "https://github.com/BYVoid/OpenCC")
-              (commit (string-append "ver." version))))
+             (url "https://github.com/BYVoid/OpenCC")
+             (commit (string-append "ver." version))))
        (file-name (git-file-name name version))
        (sha256
         (base32
-         "1pv5md225qwhbn8ql932zdg6gh1qlx3paiajaks8gfsa07yzvhr4"))
+         "07y0pvxjlmpcnym229j87qcfwnfm7vi10dad0a20xy6as55a9j3d"))
        (modules '((guix build utils)))
        (snippet
         '(begin
            ;; TODO: Unbundle tclap, darts-clone, gtest
-           (delete-file-recursively "deps/rapidjson-0.11") #t))))
+           (delete-file-recursively "deps/rapidjson-1.1.0") #t))
+       (patches (search-patches "opencc-py-binding-dont-rebuild.patch"))))
     (build-system cmake-build-system)
     (arguments
-     '(#:phases
+     ;; Required to locate the install script properly.
+     `(#:out-of-source? #f
+       #:parallel-build? #f             ;occasionally failed.
+       #:imported-modules
+       (,@%cmake-build-system-modules
+        (guix build python-build-system))
+       #:modules ((guix build cmake-build-system)
+                  ((guix build python-build-system) #:prefix python:)
+                  (guix build utils))
+       #:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'patch-3rd-party-references
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((rapidjson (assoc-ref inputs "rapidjson")))
                (substitute* "src/CMakeLists.txt"
-                 (("../deps/rapidjson-0.11")
+                 (("../deps/rapidjson-1.1.0")
                   (string-append rapidjson "/include/rapidjson")))
-             #t))))))
+               #t)))
+         (add-before 'configure 'patch-python-binding-installation
+           (lambda* (#:key outputs inputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (substitute* "python/opencc/__init__.py"
+                 (("(_libopenccfile =).*$" _ prefix)
+                  (format #f "~a os.path.join('~a/lib', _libopenccfilename)~%"
+                          prefix out))
+                 (("(_opencc_share_dir =).*$" _ prefix)
+                  (format #f "~a '~a/share/opencc'~%" prefix out))))
+             #t))
+         (add-after 'install 'install-python-binding
+           (lambda* (#:key outputs inputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (dist (string-append
+                           out "/lib/python"
+                           ,(version-major+minor (package-version python))
+                           "/site-packages")))
+               (chdir "python")
+               (mkdir-p dist)
+               (setenv "PYTHONPATH"
+                       (string-append dist ":" (getenv "PYTHONPATH")))
+               (invoke "python" "setup.py" "install"
+                       "--root=/" "--single-version-externally-managed"
+                       (string-append "--prefix=" out))
+               #t)))
+         (add-before 'install-python-binding 'enable-bytecode-determinism
+           (assoc-ref python:%standard-phases 'enable-bytecode-determinism)))))
     (native-inputs
      `(("python" ,python-wrapper)
-       ("rapidjson" ,rapidjson)))
+       ("rapidjson" ,rapidjson)
+       ("python-setuptools" ,python-setuptools)
+       ("python-wheel" ,python-wheel)))
     (home-page "https://github.com/BYVoid/OpenCC")
     (synopsis "Convert between Traditional Chinese and Simplified Chinese")
     (description "Open Chinese Convert (OpenCC) converts between Traditional
-- 
2.30.0

[Message part 4 (text/plain, inline)]
-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao

Information forwarded to guix-patches <at> gnu.org:
bug#46512; Package guix-patches. (Tue, 23 Feb 2021 13:53:01 GMT) Full text and rfc822 format available.

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

From: Zhu Zihao <all_but_last <at> 163.com>
To: 46512 <at> debbugs.gnu.org
Subject: Re: bug#46512: Acknowledgement ([PATCH]: gnu: opencc: Update to
 1.1.1.)
Date: Tue, 23 Feb 2021 21:52:17 +0800
[Message part 1 (text/plain, inline)]
ping for response.

What about split this into 2 commit?(one for update one for install py bindings).
-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#46512; Package guix-patches. (Wed, 10 Mar 2021 11:40:02 GMT) Full text and rfc822 format available.

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

From: Zhu Zihao <all_but_last <at> 163.com>
To: 46512 <at> debbugs.gnu.org
Subject: Re: bug#46512: Acknowledgement ([PATCH]: gnu: opencc: Update to
 1.1.1.)
Date: Wed, 10 Mar 2021 19:39:20 +0800
[Message part 1 (text/plain, inline)]
ping again.
-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#46512; Package guix-patches. (Thu, 11 Mar 2021 16:00:01 GMT) Full text and rfc822 format available.

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

From: Zhu Zihao <all_but_last <at> 163.com>
To: 46512 <at> debbugs.gnu.org
Subject: Re: bug#46512: Acknowledgement ([PATCH]: gnu: opencc: Update to
 1.1.1.)
Date: Thu, 11 Mar 2021 23:59:19 +0800
[Message part 1 (text/plain, inline)]
Found a new version 1.1.2. I can update it to 1.1.2 first.
-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao
[signature.asc (application/pgp-signature, inline)]

Reply sent to Zhu Zihao <all_but_last <at> 163.com>:
You have taken responsibility. (Fri, 12 Mar 2021 11:55:02 GMT) Full text and rfc822 format available.

Notification sent to Zhu Zihao <all_but_last <at> 163.com>:
bug acknowledged by developer. (Fri, 12 Mar 2021 11:55:02 GMT) Full text and rfc822 format available.

Message #19 received at 46512-done <at> debbugs.gnu.org (full text, mbox):

From: Zhu Zihao <all_but_last <at> 163.com>
To: 46512-done <at> debbugs.gnu.org
Subject: Re: bug#46512: Acknowledgement ([PATCH]: gnu: opencc: Update to
 1.1.1.)
Date: Fri, 12 Mar 2021 19:54:19 +0800
[Message part 1 (text/plain, inline)]
new patch sent.
-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#46512; Package guix-patches. (Sat, 13 Mar 2021 13:29:01 GMT) Full text and rfc822 format available.

Message #22 received at 46512-done <at> debbugs.gnu.org (full text, mbox):

From: Nicolas Goaziou <mail <at> nicolasgoaziou.fr>
To: Zhu Zihao <all_but_last <at> 163.com>
Cc: 46512-done <at> debbugs.gnu.org
Subject: Re: [bug#46512] [PATCH]: gnu: opencc: Update to 1.1.1.
Date: Sat, 13 Mar 2021 14:28:29 +0100
Hello,

Zhu Zihao <all_but_last <at> 163.com> writes:

> This patch update opencc to 1.1.1 and add the python binding build for
> it.

Thank you.

> +--- a/python/setup.py
> ++++ b/python/setup.py
> +@@ -195,7 +195,6 @@
> +         'clib/share/opencc/*',
> +     ]},
> +     cmdclass={
> +-        'build_py': BuildPyCommand,
> +         'bdist_wheel': BDistWheelCommand
> +     },

I turned this patch into a build phase since it was trivial and applied
your patch

Regards,
-- 
Nicolas Goaziou




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 11 Apr 2021 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 8 days ago.

Previous Next


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