diff options
| author | Nicolas Graves <ngraves@ngraves.fr> | 2026-01-29 10:07:40 +0100 |
|---|---|---|
| committer | Andreas Enge <andreas@enge.fr> | 2026-02-07 12:28:53 +0100 |
| commit | b96170652f04fc864736aeb0318c14462c193c4e (patch) | |
| tree | 78ba0b8aa740e674c4cd2fd5796cbaeb0c6bc657 /gnu/packages/textutils.scm | |
| parent | 5e19fd4b548e51ecb2550c746893c5fe95242fcb (diff) | |
gnu: opencc: Improve style and switch to pyproject.
* gnu/packages/textutils.scm (opencc):
[arguments]: Use list instead of quote.
<#:imported-modules, #:modules>: Switch to pyproject-build-system.
<#:phases>: Rewrite using gexps, #$output, site-packages, and
search-ipnut-directory.
Change-Id: I050acb3be2ff0a34fc6156113a4cc997bedd2937
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
Diffstat (limited to 'gnu/packages/textutils.scm')
| -rw-r--r-- | gnu/packages/textutils.scm | 95 |
1 files changed, 42 insertions, 53 deletions
diff --git a/gnu/packages/textutils.scm b/gnu/packages/textutils.scm index 92f8d3a9f7d..ce83956268a 100644 --- a/gnu/packages/textutils.scm +++ b/gnu/packages/textutils.scm | |||
| @@ -1601,61 +1601,50 @@ absolute \"path\" to it.") | |||
| 1601 | (build-system cmake-build-system) | 1601 | (build-system cmake-build-system) |
| 1602 | (arguments | 1602 | (arguments |
| 1603 | ;; Required to locate the install script properly. | 1603 | ;; Required to locate the install script properly. |
| 1604 | `(#:out-of-source? #f | 1604 | (list |
| 1605 | #:tests? #f | 1605 | #:out-of-source? #f |
| 1606 | #:parallel-build? #f ;occasionally failed. | 1606 | #:tests? #f |
| 1607 | #:imported-modules | 1607 | #:parallel-build? #f ;occasionally failed. |
| 1608 | (,@%cmake-build-system-modules | 1608 | #:imported-modules (append %cmake-build-system-modules |
| 1609 | (guix build python-build-system)) | 1609 | %pyproject-build-system-modules) |
| 1610 | #:modules ((guix build cmake-build-system) | 1610 | #:modules '((guix build cmake-build-system) |
| 1611 | ((guix build python-build-system) #:prefix python:) | 1611 | ((guix build pyproject-build-system) #:prefix py:) |
| 1612 | (guix build utils)) | 1612 | (guix build utils)) |
| 1613 | #:phases | 1613 | #:phases |
| 1614 | (modify-phases %standard-phases | 1614 | #~(modify-phases %standard-phases |
| 1615 | (add-after 'unpack 'prevent-rebuild-during-installation | 1615 | (add-after 'unpack 'prevent-rebuild-during-installation |
| 1616 | (lambda _ | 1616 | (lambda _ |
| 1617 | (substitute* "python/setup.py" | 1617 | (substitute* "python/setup.py" |
| 1618 | (("'build_py': BuildPyCommand,") "")) | 1618 | (("'build_py': BuildPyCommand,") "")))) |
| 1619 | #t)) | 1619 | (add-after 'unpack 'patch-3rd-party-references |
| 1620 | (add-after 'unpack 'patch-3rd-party-references | 1620 | (lambda* (#:key inputs #:allow-other-keys) |
| 1621 | (lambda* (#:key inputs #:allow-other-keys) | 1621 | (substitute* "src/CMakeLists.txt" |
| 1622 | (let ((rapidjson (assoc-ref inputs "rapidjson"))) | 1622 | (("../deps/rapidjson-1.1.0") |
| 1623 | (substitute* "src/CMakeLists.txt" | 1623 | (search-input-directory inputs "/include/rapidjson"))))) |
| 1624 | (("../deps/rapidjson-1.1.0") | 1624 | (add-before 'configure 'patch-python-binding-installation |
| 1625 | (string-append rapidjson "/include/rapidjson"))) | 1625 | (lambda _ |
| 1626 | #t))) | 1626 | (substitute* "python/opencc/__init__.py" |
| 1627 | (add-before 'configure 'patch-python-binding-installation | 1627 | (("(_libopenccfile =).*$" _ prefix) |
| 1628 | (lambda* (#:key outputs inputs #:allow-other-keys) | 1628 | (format #f "~a os.path.join('~a/lib', _libopenccfilename)~%" |
| 1629 | (let ((out (assoc-ref outputs "out"))) | 1629 | prefix #$output)) |
| 1630 | (substitute* "python/opencc/__init__.py" | 1630 | (("(_opencc_share_dir =).*$" _ prefix) |
| 1631 | (("(_libopenccfile =).*$" _ prefix) | 1631 | (format #f "~a '~a/share/opencc'~%" prefix #$output))))) |
| 1632 | (format #f "~a os.path.join('~a/lib', _libopenccfilename)~%" | 1632 | (add-after 'install 'install-python-binding |
| 1633 | prefix out)) | 1633 | (lambda* (#:key outputs inputs #:allow-other-keys) |
| 1634 | (("(_opencc_share_dir =).*$" _ prefix) | 1634 | (let ((dist (py:site-packages inputs outputs))) |
| 1635 | (format #f "~a '~a/share/opencc'~%" prefix out)))) | 1635 | (chdir "python") |
| 1636 | #t)) | 1636 | (mkdir-p dist) |
| 1637 | (add-after 'install 'install-python-binding | 1637 | (setenv "PYTHONPATH" |
| 1638 | (lambda* (#:key outputs inputs #:allow-other-keys) | 1638 | (string-append dist ":" (getenv "GUIX_PYTHONPATH"))) |
| 1639 | (let* ((out (assoc-ref outputs "out")) | 1639 | (invoke "python" "setup.py" "install" |
| 1640 | (dist (string-append | 1640 | "--root=/" "--single-version-externally-managed" |
| 1641 | out "/lib/python" | 1641 | (string-append "--prefix=" #$output))))) |
| 1642 | ,(version-major+minor (package-version python)) | 1642 | (add-before 'install-python-binding 'enable-bytecode-determinism |
| 1643 | "/site-packages"))) | 1643 | (assoc-ref py:%standard-phases 'enable-bytecode-determinism))))) |
| 1644 | (chdir "python") | ||
| 1645 | (mkdir-p dist) | ||
| 1646 | (setenv "PYTHONPATH" | ||
| 1647 | (string-append dist ":" (getenv "GUIX_PYTHONPATH"))) | ||
| 1648 | (invoke "python" "setup.py" "install" | ||
| 1649 | "--root=/" "--single-version-externally-managed" | ||
| 1650 | (string-append "--prefix=" out)) | ||
| 1651 | #t))) | ||
| 1652 | (add-before 'install-python-binding 'enable-bytecode-determinism | ||
| 1653 | (assoc-ref python:%standard-phases 'enable-bytecode-determinism))))) | ||
| 1654 | (native-inputs | 1644 | (native-inputs |
| 1655 | `(("python" ,python-wrapper) | 1645 | (list python-wrapper |
| 1656 | ("rapidjson" ,rapidjson) | 1646 | rapidjson |
| 1657 | ("python-setuptools" ,python-setuptools) | 1647 | python-setuptools)) |
| 1658 | ("python-wheel" ,python-wheel))) | ||
| 1659 | (home-page "https://github.com/BYVoid/OpenCC") | 1648 | (home-page "https://github.com/BYVoid/OpenCC") |
| 1660 | (synopsis "Convert between Traditional Chinese and Simplified Chinese") | 1649 | (synopsis "Convert between Traditional Chinese and Simplified Chinese") |
| 1661 | (description "Open Chinese Convert (OpenCC) converts between Traditional | 1650 | (description "Open Chinese Convert (OpenCC) converts between Traditional |
