From d72b88651d66d0cdfe2a0bd94fde810b8ac7c73a Mon Sep 17 00:00:00 2001 From: Comrade Yuri Date: Sat, 19 Oct 2019 20:50:41 +0200 Subject: [PATCH 4/5] 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(-) diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm index 2110518f0b..a57cddfbcb 100644 --- a/gnu/packages/game-development.scm +++ b/gnu/packages/game-development.scm @@ -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 "This package contains the shared libraries and Python modules @@ -1109,6 +1116,28 @@ of renpy.") #: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 @@ -1119,10 +1148,10 @@ of renpy.") ;; `-- 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. @@ -1142,6 +1171,8 @@ of renpy.") (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) @@ -1188,8 +1219,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) @@ -1222,7 +1253,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") @@ -1239,10 +1270,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