Vivien Kraus wrote 3 years ago
[PATCH] Meson needs proper wrapping
(address . guix-patches@gnu.org)
Dear guix,
Meson needs to be wrapped, but the wrapping must not execute a new
process, if I understand correctly. I could use wrap-script, but I think
it’s more pythonic to set the path through sys.path rather than setting
an environment variable.
Now, this will create a world rebuild… What do you think?
Vivien
From 08845844e8e1a18232bf54f9f3f0b71d5e0c71ef 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) [phase wrap]: Wrap the python path as
python code.
---
gnu/packages/build-tools.scm | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
Toggle diff (29 lines)
diff --git a/gnu/packages/build-tools.scm b/gnu/packages/build-tools.scm
index 849101c2a4..ef5aa4bd35 100644
--- a/gnu/packages/build-tools.scm
+++ b/gnu/packages/build-tools.scm
@@ -283,7 +283,21 @@ (define-public meson
#:phases (modify-phases %standard-phases
;; Meson calls the various executables in out/bin through the
;; Python interpreter, so we cannot use the shell wrapper.
- (delete 'wrap))))
+ (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"))))))))))
(inputs `(("ninja" ,ninja)))
(propagated-inputs `(("python" ,python)))
(home-page "https://mesonbuild.com/")
--
2.34.0
-----BEGIN PGP SIGNATURE-----
iQGzBAEBCAAdFiEEq4yIHjMvkliPpwQnO7C8EjLYuCwFAmGWYfQACgkQO7C8EjLY
uCx6RQv/dAim25a86h4Ob7Kxzu7VW8Zh5JCzGt8xEjPyerTsLw6hLxNpNRZz2V9k
giTdkcGVgnrdT5vx6IceoC0yQRE2L6AteWhI9k9toxZB1AEKr0i+C2BV668ydNUk
LSRAkD50gwKk+MAbgfqA0g5+hnjxQIPGyMvUX11uhKWzirEwfG+MukLOaO8BmPV2
s6HLZ9O0riXP+CZNrIcJYhk/YfVX5wFT754ps2UU4ptFwZetPSuSq1Mk0vIjeONH
XCLVfu8vpxf7SnLW0Y5TclMdjtKJCP0eS2OsAyN5vfjuq+zElZXmek2eby85M0BR
df5J8I+wEM6kWDiwQ6vK/MnO5mSu1LgH3RgRfR+t36wjpNUuSryeuufbQ4GGCAS3
IZcE9QlxvM55N6hj7SCUwXBASoeOkdn3YY9FeOSiVai5WikjQuMfxiWwntP/+R+L
AcH+eFRf3nIqzDX6UaRR/c9Js80msPHRAJo40Lz5WAkaJFRCPiSU3aycYVlDpepO
U//xlRs7
=9sky
-----END PGP SIGNATURE-----