From 863ecacec6c89ec5e148ca478190bfa505da2045 Mon Sep 17 00:00:00 2001
From: Comrade Yuri <yuri@nijino>
Date: Sat, 19 Oct 2019 20:50:41 +0200
Subject: [PATCH 4/4] gnu: fix renpy-launcher
* /gnu/packages/game-development: (python2-renpy): Patch xdg-open.
(renpy): Merge "out" and "launcher". Patch python, renpy binary and xdg-open.
---
gnu/packages/game-development.scm | 52 +++++++++++++++++++++++++------
1 file changed, 42 insertions(+), 10 deletions(-)
@@ -1037,6 +1037,12 @@ developed mainly for Ren'py.")
#:python ,python-2
#:phases
(modify-phases %standard-phases
+ (add-after 'unpack 'fix-commands
+ (lambda _
+ (substitute* "renpy/editor.py"
+ (("xdg-open")
+ (which "xdg-open")))
+ #t))
(add-after 'set-paths 'set-build-vars
(lambda* (#:key inputs #:allow-other-keys)
(setenv "RENPY_CYTHON"
@@ -1089,7 +1095,8 @@ developed mainly for Ren'py.")
("sdl-union"
,(sdl-union (list sdl2 sdl2-image sdl2-mixer sdl2-ttf)))))
(native-inputs
- `(("python2-cython" ,python2-cython)))
+ `(("python2-cython" ,python2-cython)
+ ("xdg-utils" ,xdg-utils)))
(home-page "http://www.renpy.org/")
(synopsis "Ren'py python module")
(description #f)
@@ -1108,6 +1115,28 @@ developed mainly for Ren'py.")
#:python ,python-2
#:phases
(modify-phases %standard-phases
+ (add-after 'unpack 'fix-commands
+ (lambda* (#:key outputs #:allow-other-keys)
+ (substitute* "launcher/game/choose_directory.rpy"
+ (("/usr/bin/python") (which "python2")))
+ (substitute* "launcher/game/front_page.rpy"
+ (("xdg-open")
+ (which "xdg-open")))
+ (substitute* "launcher/game/project.rpy"
+ (("cmd = \\[ executable, \"-EO\", sys.argv\\[0\\] \\]")
+ (string-append "cmd = [ \"" (assoc-ref outputs "out")
+ "/bin/renpy\" ]"))
+ ;; Projects are still created in the usual style, so we need
+ ;; to adjust the path.
+ (("cmd.append\\(self.path\\)")
+ "cmd.append(self.path + \"/game\")"))
+ #t))
+ (add-after 'unpack 'drop-game-from-paths
+ (lambda _
+ (substitute* (list "launcher/game/gui7.rpy"
+ "launcher/game/gui7/images.py")
+ ((", \"game\",") ","))
+ #t))
;; TODO: Here we would use ren'py to compile the games.
(delete 'build)
(replace 'install
@@ -1118,10 +1147,10 @@ developed mainly for Ren'py.")
;; `-- share/renpy ; i.e. path_to_renpy_base()
;; `-- common
;;
- ;; Note that common is also a de facto unused subdirectory of
- ;; lib/pythonX.Y/site-packages/renpy. On other systems,
- ;; renpy_base would point to site-packages or even somewhere in
- ;; /opt. The former approach is not as straightforward as it seems
+ ;; Note that common is also a de facto unused directory in
+ ;; python2-renpy. On other systems, renpy_base would point to
+ ;; site-packages or even somewhere in /opt.
+ ;; The former approach is not as straightforward as it seems
;; -- it causes renpy to load files twice for some weird reason --
;; and the latter is impossible on Guix. Hence the detour through
;; share/renpy and the custom renpy program.
@@ -1141,6 +1170,8 @@ developed mainly for Ren'py.")
(mkdir-p (string-append out "/bin"))
(copy-recursively "renpy/common"
(string-append out "/share/renpy/common"))
+ (copy-recursively "gui"
+ (string-append out "/share/renpy/gui"))
(call-with-output-file bin/renpy
(lambda (port)
@@ -1187,8 +1218,8 @@ structure.\"\"\", file=sys.stderr)
The basedir is the directory, in which .rpy files live -- usually the 'game'
subdirectory of a game packaged by Ren'py.
-If you want the Ren'py launcher, use renpy-launcher from renpy:launcher
-instead.\"\"\", file=sys.stderr)
+If you want the Ren'py launcher, use renpy-launcher instead.\"\"\",
+ file=sys.stderr)
sys.exit()
renpy.bootstrap.bootstrap(renpy_base)
@@ -1221,7 +1252,7 @@ if __name__ == \"__main__\":
share)))
(chmod launcher #o755)))
- (install-renpy-game #:output (assoc-ref outputs "launcher")
+ (install-renpy-game #:output (assoc-ref outputs "out")
#:game "launcher")
(install-renpy-game #:output (assoc-ref outputs "the-question")
@@ -1238,10 +1269,11 @@ if __name__ == \"__main__\":
`("PYTHONPATH" = (,(getenv "PYTHONPATH"))))
#t)))))
(inputs
- `(("python2-pygame" ,python2-pygame-sdl2)
+ `(("python2-tkinter" ,python-2 "tk")
+ ("python2-pygame" ,python2-pygame-sdl2)
("python2-renpy" ,python2-renpy)))
(outputs
- (list "out" "launcher" "tutorial" "the-question"))
+ (list "out" "tutorial" "the-question"))
(home-page "http://www.renpy.org/")
(synopsis "Visual Novel Engine")
(description "Ren'Py is a visual novel engine -- used by thousands of
--
2.23.0