build-system: renpy: Migrate to (json).

* guix/build/renpy-build-system.scm: Use (json) rather than (guix build json).
(install, install-desktop-file): Replace ‘read-json’ with ‘json->scm’.
* guix/build-system/renpy.scm (default-guile-json): New variable.
(%renpy-build-system-modules): Adjust accordingly.
(renpy-build): Add guile-json argument and use it as extension.

Fixes guix/guix#2618.
This commit is contained in:
Liliana Marie Prikler 2025-09-11 12:40:26 +02:00
parent 5bbed7ee01
commit 0353a510cf
No known key found for this signature in database
GPG key ID: 442A84B8C70E2F87
2 changed files with 25 additions and 19 deletions

View file

@ -37,10 +37,13 @@
"Return the default Ren'py package, resolved lazily."
(@* (gnu packages game-development) renpy))
(define (default-guile-json)
"Return the default Guile JSON package, resolved lazily."
(@* (gnu packages guile) guile-json-4))
(define %renpy-build-system-modules
;; Build-side modules imported by default.
`((guix build renpy-build-system)
(guix build json)
(guix build python-build-system)
,@%default-gnu-imported-modules))
@ -81,26 +84,29 @@
(search-paths '())
(system (%current-system))
(guile #f)
(guile-json (default-guile-json))
(imported-modules %renpy-build-system-modules)
(modules '((guix build renpy-build-system)
(guix build utils))))
"Build SOURCE using RENPY, and with INPUTS."
(define builder
(with-imported-modules imported-modules
#~(begin
(use-modules #$@(sexp->gexp modules))
(renpy-build #:name #$name
#:source #+source
#:configure-flags #$configure-flags
#:system #$system
#:phases #$phases
#:outputs #$(outputs->gexp outputs)
#:output #$output
#:game #$game
#:search-paths '#$(sexp->gexp
(map search-path-specification->sexp
search-paths))
#:inputs #$(input-tuples->gexp inputs)))))
(with-extensions (list guile-json)
(with-imported-modules imported-modules
#~(begin
(use-modules #$@(sexp->gexp modules))
(renpy-build #:name #$name
#:source #+source
#:configure-flags #$configure-flags
#:system #$system
#:phases #$phases
#:outputs #$(outputs->gexp outputs)
#:output #$output
#:game #$game
#:search-paths
'#$(sexp->gexp
(map search-path-specification->sexp
search-paths))
#:inputs #$(input-tuples->gexp inputs))))))
(mlet %store-monad ((guile (package->derivation (or guile (default-guile))
system #:graft? #f)))

View file

@ -19,10 +19,10 @@
(define-module (guix build renpy-build-system)
#:use-module ((guix build gnu-build-system) #:prefix gnu:)
#:use-module ((guix build python-build-system) #:prefix python:)
#:use-module (guix build json)
#:use-module (guix build utils)
#:use-module (ice-9 match)
#:use-module (ice-9 ftw)
#:use-module (json)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:export (%standard-phases
@ -43,7 +43,7 @@
(let* ((out (assoc-ref outputs output))
(json-dump (call-with-input-file (string-append game
"/renpy-build.json")
read-json))
json->scm))
(build (assoc-ref json-dump "build"))
(executable-name (assoc-ref build "executable_name"))
(directory-name (assoc-ref build "directory_name")))
@ -67,7 +67,7 @@
(let* ((out (assoc-ref outputs output))
(json-dump (call-with-input-file (string-append game
"/renpy-build.json")
read-json))
json->scm))
(build (assoc-ref json-dump "build"))
(directory-name (assoc-ref build "directory_name"))
(executable-name (assoc-ref build "executable_name")))