Archived
1
0
Fork 0

gnu: Refactor renpy build.

* gnu/packages/game-development.scm (python2-renpy)[arguments]: Use directory
excursions instead of invoking `chdir' directly in phases.
This commit is contained in:
Leo Prikler 2020-01-16 18:43:10 +01:00 committed by Nicolas Goaziou
parent af4796d5ca
commit 37c52b5b15
No known key found for this signature in database
GPG key ID: DA00B4F048E92F2D

View file

@ -1086,39 +1086,31 @@ developed mainly for Ren'py.")
(setenv "RENPY_DEPS_INSTALL" (string-join (map cdr inputs) ":")) (setenv "RENPY_DEPS_INSTALL" (string-join (map cdr inputs) ":"))
#t)) #t))
(replace 'build (replace 'build
(lambda args (lambda* (#:key inputs outputs #:allow-other-keys #:rest args)
(apply ;; The "module" subdirectory contains a python (really cython)
(lambda* (build-root #:key inputs outputs #:allow-other-keys) ;; project, which is built using a script, that is thankfully
;; The "module" subdirectory contains a python (really cython) ;; named "setup.py".
;; project, which is built using a script, that is thankfully (with-directory-excursion "module"
;; named "setup.py". (apply (assoc-ref %standard-phases 'build) args))
(chdir "module") ;; the above causes renpy.__init__ to be compiled but does not
(apply (assoc-ref %standard-phases 'build) args) ;; compile anything else, hence we do that here
;; the above causes renpy.__init__ to be compiled but does not (delete-file "renpy/__init__.pyc")
;; compile anything else, hence we do that here (invoke "python" "-m" "compileall" "renpy")
(chdir build-root)
(delete-file "renpy/__init__.pyc")
(invoke "python" "-m" "compileall" "renpy"))
(getcwd) args)
#t)) #t))
(replace 'install (replace 'install
(lambda args (lambda* (#:key inputs outputs #:allow-other-keys #:rest args)
(apply ;; Again, we have to wrap the module installation.
(lambda* (build-root #:key inputs outputs #:allow-other-keys) ;; Additionally, we want to install the python code
;; Again, we have to wrap the module installation. ;; (both source and compiled) in the same directory.
;; Additionally, we want to install the python code (let* ((out (assoc-ref outputs "out"))
;; (both source and compiled) in the same directory. (site (string-append "/lib/python"
(let* ((out (assoc-ref outputs "out")) ,(version-major+minor
(site (string-append "/lib/python" (package-version python-2))
,(version-major+minor "/site-packages")))
(package-version python-2)) (with-directory-excursion "module"
"/site-packages"))) (apply (assoc-ref %standard-phases 'install) args))
(chdir "module") (copy-recursively "renpy"
(apply (assoc-ref %standard-phases 'install) args) (string-append out site "/renpy")))
(chdir build-root)
(copy-recursively "renpy"
(string-append out site "/renpy"))))
(getcwd) args)
#t))))) #t)))))
(inputs (inputs
`(("ffmpeg" ,ffmpeg) `(("ffmpeg" ,ffmpeg)