guix_mirror_bot pushed a commit to branch python-team
in repository guix.
commit 637a48ce68dbc48cb552c6a207f7eeb27bc21752
Author: Nicolas Graves <[email protected]>
AuthorDate: Sun Jan 18 10:29:24 2026 +0100
gnu: gobject-introspection: Wrap necessary binaries.
[email protected] removes the distutils module, which now has to be provided
through python-setuptools.
* gnu/packages/glib.scm (goject-introspection-minimal)
[arguments]<#:phases>: Add phase 'wrap.
<#:modules>: Adjust them accordingly.
[native-inputs]: Improve style.
[propagated-inputs]: Add python-setuptools-bootstrap.
(gobject-introspection)[propagated-inputs]: Replace
python-setuptools-bootstrap by python-setuptools.
Change-Id: Id5b940c13c9688391f399ebfd1ebbc125154ee27
Signed-off-by: Sharlatan Hellseher <[email protected]>
---
gnu/packages/glib.scm | 56 ++++++++++++++++++++++++++++++++++++++++++---------
1 file changed, 47 insertions(+), 9 deletions(-)
diff --git a/gnu/packages/glib.scm b/gnu/packages/glib.scm
index e0eb107e5a..bd95209965 100644
--- a/gnu/packages/glib.scm
+++ b/gnu/packages/glib.scm
@@ -76,6 +76,7 @@
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages pretty-print)
#:use-module (gnu packages python)
+ #:use-module (gnu packages python-build)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages sqlite)
#:use-module (gnu packages web)
@@ -643,6 +644,12 @@ be used when cross-compiling."
;; as discussed here: https://issues.guix.gnu.org/50201#60.
"-Dbuild_introspection_data=false"))
'())
+ #:modules
+ ((guix build meson-build-system)
+ (guix build utils)
+ (ice-9 match)
+ (srfi srfi-1)
+ (srfi srfi-26))
#:phases
,#~
(modify-phases %standard-phases
@@ -659,6 +666,33 @@ be used when cross-compiling."
(substitute* "tools/g-ir-tool-template.in"
(("#!@PYTHON_CMD@")
(string-append "#!" (which "python3"))))))
+ ;; Copy the site-packages procedure rather than importing them to
+ ;; maintain pyproject/glib-or-gtk build-systems'independence.
+ (add-after 'install 'wrap
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (define (search-input-directories pred dir)
+ (filter pred
+ (map (match-lambda
+ ((name . directory)
+ (string-append directory "/" dir)))
+ inputs)))
+ (let* ((version #$(version-major+minor
+ (package-version
+ (this-package-input "python"))))
+ (site-path (string-append "lib/python" version
+ "/site-packages"))
+ ;; Remove meson, but keep the rest.
+ (pred (lambda (dir)
+ (and (directory-exists? dir)
+ (string-contains dir "python-"))))
+ (paths (search-input-directories pred site-path)))
+ (for-each
+ (cute wrap-program <>
+ `("GUIX_PYTHONPATH" ":" prefix
+ (,(string-join paths ":"))))
+ ;; These require access to python-setuptools site-packages.
+ (list (search-input-file outputs "/bin/g-ir-annotation-tool")
+ (search-input-file outputs "/bin/g-ir-scanner"))))))
#$@(if (%current-target-system)
;; Meson gives python extensions an incorrect name, see
;; <https://github.com/mesonbuild/meson/issues/7049>.
@@ -670,20 +704,22 @@ be used when cross-compiling."
"/_giscanner"))))
#~()))))
(native-inputs
- `(,@(if (%current-target-system)
- `(("python" ,python))
- '())
- ("glib" ,glib-minimal "bin")
- ("pkg-config" ,pkg-config)
- ("bison" ,bison)
- ("flex" ,flex)))
+ (cons*
+ bison
+ flex
+ (list glib-minimal "bin")
+ pkg-config
+ (if (%current-target-system)
+ (list python)
+ (list))))
(inputs
(list python zlib))
(propagated-inputs
(list glib-minimal
;; In practice, GIR users will need libffi when using
;; gobject-introspection.
- libffi))
+ libffi
+ python-setuptools-bootstrap))
(native-search-paths
(list
(search-path-specification
@@ -712,7 +748,9 @@ provide bindings to call into the C library.")
(replace "glib" glib)))
(propagated-inputs
(modify-inputs (package-propagated-inputs base)
- (replace "glib" glib))))))
+ (replace "glib" glib)
+ ;; Note: The label stays the same despite the name change.
+ (replace "python-setuptools-bootstrap" python-setuptools))))))
(define intltool
(package