all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Liliana Marie Prikler <liliana.prikler@gmail.com>
To: 52595@debbugs.gnu.org
Subject: [bug#52595] [PATCH 3/5] gnu: renpy: Move renpy command to aux-files.
Date: Fri, 17 Dec 2021 19:59:05 +0100	[thread overview]
Message-ID: <4a4bfdf0cc27a32ed72abaf80e17032925d2b9a6.camel@gmail.com> (raw)
In-Reply-To: <9af1bb4930763c511306573bbf032d6ed700ff25.camel@gmail.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 5820 bytes --]

* gnu/packages/aux-files/renpy/renpy.in: New file.
* gnu/packages/game-development.scm (renpy)[install]: Use renpy.in with
substitute*.
* Makefile.am (AUX_FILES): Add it here.
---
 Makefile.am                           |  1 +
 gnu/packages/aux-files/renpy/renpy.in | 48 +++++++++++++++++++
 gnu/packages/game-development.scm     | 68 ++++-----------------------
 3 files changed, 57 insertions(+), 60 deletions(-)
 create mode 100644 gnu/packages/aux-files/renpy/renpy.in

diff --git a/Makefile.am b/Makefile.am
index c4ccee65f1..627cf3ca64 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -403,6 +403,7 @@ AUX_FILES =						\
   gnu/packages/aux-files/pack-audit.c			\
   gnu/packages/aux-files/python/sanity-check.py		\
   gnu/packages/aux-files/python/sitecustomize.py	\
+  gnu/packages/aux-files/renpy/renpy.in	\
   gnu/packages/aux-files/run-in-namespace.c
 
 # Templates, examples.
diff --git a/gnu/packages/aux-files/renpy/renpy.in b/gnu/packages/aux-files/renpy/renpy.in
new file mode 100644
index 0000000000..914a735fa4
--- /dev/null
+++ b/gnu/packages/aux-files/renpy/renpy.in
@@ -0,0 +1,48 @@
+#! @PYTHON@
+# -*- mode: python -*-
+
+from __future__ import print_function
+
+import os
+import sys
+import warnings
+
+def path_to_common(renpy_base):
+    return renpy_base + "/common"
+
+def path_to_saves(gamedir, save_directory=None):
+    import renpy
+
+    if save_directory is None:
+        save_directory = renpy.config.save_directory
+        save_directory = renpy.exports.fsencode(save_directory)
+
+    if not save_directory:
+        return gamedir + "/saves"
+
+    return os.path.join(os.path.expanduser("~/.renpy"), save_directory)
+
+def main():
+    try:
+        import renpy.bootstrap
+        import renpy.arguments
+    except ImportError:
+        print("""Could not import renpy.bootstrap.
+Please ensure you decompressed Ren'py correctly, preserving the directory
+structure.""", file=sys.stderr)
+        raise
+
+    args = renpy.arguments.bootstrap()
+    if not args.basedir:
+        print("""This Ren'py requires a basedir to launch.
+The basedir is the directory, in which .rpy source files or compiled .rpyc files
+live -- usually the 'game' subdirectory of a game packaged by Ren'py.
+
+If you want the Ren'py launcher, use \"renpy-launcher\" instead.""",
+              file=sys.stderr)
+        sys.exit()
+
+    renpy.bootstrap.bootstrap("@RENPY_BASE@")
+
+if __name__ == "__main__":
+    main()
diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index fb8744382c..955d630704 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -1444,70 +1444,17 @@ (define-public renpy
              ;;     `-- Super Awesome Game.sh
              (let* ((out (assoc-ref outputs "out"))
                     (bin/renpy (string-append out "/bin/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)
-                   (format port "#!~a/bin/python2~%"
-                           (assoc-ref inputs "python2"))
-                   (format port "
-from __future__ import print_function
-
-import os
-import sys
-import warnings
-
-def path_to_common(renpy_base):
-    return renpy_base + \"/common\"
-
-def path_to_saves(gamedir, save_directory=None):
-    import renpy  # @UnresolvedImport
-
-    if save_directory is None:
-        save_directory = renpy.config.save_directory
-        save_directory = renpy.exports.fsencode(save_directory)
-
-    if not save_directory:
-        return gamedir + \"/saves\"
-
-    return os.path.expanduser(\"~~/.renpy/\" + save_directory)
-
-def path_to_renpy_base():
-    return \"~a\"
-
-def main():
-    renpy_base = path_to_renpy_base()
-    try:
-        import renpy.bootstrap
-        import renpy.arguments
-    except ImportError:
-        print(\"\"\"Could not import renpy.bootstrap.
-Please ensure you decompressed Ren'Py correctly, preserving the directory
-structure.\"\"\", file=sys.stderr)
-        raise
-
-    args = renpy.arguments.bootstrap()
-    if not args.basedir:
-        print(\"\"\"This Ren'py requires a basedir to launch.
-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 instead.\"\"\",
-              file=sys.stderr)
-        sys.exit()
-
-    renpy.bootstrap.bootstrap(renpy_base)
-
-if __name__ == \"__main__\":
-    main()
-"
-                           (string-append out "/share/renpy"))))
-               (chmod bin/renpy #o755)
-               #t)))
+               (mkdir-p (string-append out "/bin"))
+               (copy-file (assoc-ref inputs "renpy.in") bin/renpy)
+               (substitute* bin/renpy
+                 (("@PYTHON@") (search-input-file inputs "bin/python2"))
+                 (("@RENPY_BASE@") (string-append out "/share/renpy")))
+               (chmod bin/renpy #o755))))
 
          (add-after 'install 'install-games
            (lambda* (#:key outputs #:allow-other-keys)
@@ -1561,7 +1508,8 @@ (define* (install-renpy-game #:key output game name (renpy renpy)
                                     inputs))))))))
                #t))))))
     (inputs
-     `(("python2-renpy" ,python2-renpy)
+     `(("renpy.in" ,(search-auxiliary-file "renpy/renpy.in"))
+       ("python2-renpy" ,python2-renpy)
        ("python2-tkinter" ,python-2 "tk")
        ("python2" ,python-2) ; for ‘fix-commands’ and ‘wrap’
        ("xdg-utils" ,xdg-utils)))
-- 
2.34.0





  parent reply	other threads:[~2021-12-18 10:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-17 19:52 [bug#52595] [PATCH 0/5] Update Ren'py to 7.4.11 Liliana Marie Prikler
2021-12-17 17:56 ` [bug#52595] [PATCH 1/5] gnu: python-future: Fix sanity check Liliana Marie Prikler
2021-12-17 18:22 ` [bug#52595] [PATCH 2/5] gnu: python2-renpy: Do not delete non-existing file Liliana Marie Prikler
2021-12-17 18:59 ` Liliana Marie Prikler [this message]
2021-12-17 19:31 ` [bug#52595] [PATCH 4/5] gnu: python2-pygame-sdl2: Update to renpy version 7.4.11 Liliana Marie Prikler
2021-12-17 19:32 ` [bug#52595] [PATCH 5/5] gnu: python2-renpy: Update to 7.4.11 Liliana Marie Prikler
2022-01-15  9:02   ` bug#52595: " Liliana Marie Prikler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4a4bfdf0cc27a32ed72abaf80e17032925d2b9a6.camel@gmail.com \
    --to=liliana.prikler@gmail.com \
    --cc=52595@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.