From f25082c0a695734aaada2d286ef1770de5f99c2b Mon Sep 17 00:00:00 2001
From: Vivien Kraus <vivien@planete-kraus.eu>
Date: Thu, 18 Nov 2021 15:17:52 +0100
Subject: [PATCH] gnu: meson: Extend the python path in the installed program.
* gnu/packages/build-tools.scm (meson-wrapped): New variable.
---
gnu/packages/build-tools.scm | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
@@ -297,6 +297,31 @@ (define-public meson
resembles Python.")
(license license:asl2.0)))
+(define-public meson-wrapped
+ (package/inherit meson
+ (arguments
+ `(;; FIXME: Tests require many additional inputs and patching many
+ ;; hard-coded file system locations in "run_unittests.py".
+ #:tests? #f
+ #:phases (modify-phases %standard-phases
+ ;; Meson calls the various executables in out/bin through the
+ ;; Python interpreter, so we cannot use the shell wrapper.
+ (replace 'wrap
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((path (string-split (getenv "GUIX_PYTHONPATH") #\:)))
+ (substitute* (string-append (assoc-ref outputs "out") "/bin/meson")
+ (("# EASY-INSTALL-ENTRY-SCRIPT")
+ (format #f "\
+import sys
+~a
+# EASY-INSTALL-ENTRY-SCRIPT"
+ (string-join
+ (map (lambda (path)
+ (format #f "sys.path.insert(0, '~a')"
+ path))
+ (reverse path))
+ "\n"))))))))))))
+
;;; This older Meson variant is kept for now for gtkmm and others that may
;;; have problems with 0.60.
(define-public meson-0.59
--
2.34.0