diff mbox series

[bug#57431,v1,2/3] gnu: Add python-pyqt, version 6.5.2.

Message ID 817ca09b733ed2163ec3147a1f131844fa0080e1.1700407095.git.herman@rimm.ee
State New
Headers show
Series [bug#57431,v1,1/3] gnu: Add python-pyqt6-sip. | expand

Commit Message

Herman Rimm Nov. 19, 2023, 3:18 p.m. UTC
From: Zhu Zihao <all_but_last@163.com>

* gnu/packages/qt.scm (python-pyqt-6): New variable.
---
 gnu/packages/qt.scm | 49 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

Comments

Ludovic Courtès Nov. 22, 2023, 3:47 p.m. UTC | #1
Herman Rimm <herman@rimm.ee> skribis:

> From: Zhu Zihao <all_but_last@163.com>
>
> * gnu/packages/qt.scm (python-pyqt-6): New variable.

[...]

> +    (inputs ; Qt5 dependencies only in python-pyqt:
> +     ; (qt)connectivity, location, sensors, serialport, x11extras, xmlpatterns.
> +     `(("python" ,python-wrapper)
> +       ("qtbase" ,qtbase)
> +       ("qtdeclarative" ,qtdeclarative)
> +       ("qtmultimedia" ,qtmultimedia)
> +       ("qtpositioning" ,qtpositioning)
> +       ("qtsvg" ,qtsvg)
> +       ("qttools" ,qttools)
> +       ("qtwebchannel" ,qtwebchannel)
> +       ("qtwebsockets" ,qtwebsockets)))

Could you run ‘guix style -f inputs --input-simplification=always python-pyqt-6’?

> +       #:phases
> +       #~(modify-phases %standard-phases
> +         ;; When building python-pyqtwebengine, <qprinter.h> can not be
> +         ;; included.  Here we substitute the full path to the header in the
> +         ;; store.
> +         (add-after 'unpack 'substitute-source
> +           (lambda* (#:key inputs  #:allow-other-keys)
> +             (let* ((qtbase (assoc-ref inputs "qtbase"))
> +                    (qtprinter.h (string-append "\"" qtbase "/include/qt6/QtPrintSupport/qprinter.h\"")))

I understand it’s copied from ‘python-pyqt’ but IWBN to write it along
these lines:

  (let ((qtprinter.h
         (search-input-file inputs
                            "/include/qt6/QtPrintSupport/qprinter.h")))
    …)

(We could make the same changes in ‘python-pyqt’ in a separate patch.)

Thanks,
Ludo’.
diff mbox series

Patch

diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index 242a5da172..eea13d1ea2 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -29,6 +29,7 @@ 
 ;;; Copyright © 2022 Yash Tiwari <yasht@mailbox.org>
 ;;; Copyright © 2023 Sharlatan Hellseher <sharlatanus@gmail.com>
 ;;; Copyright © 2022 Zheng Junjie <873216071@qq.com>
+;;; Copyright © 2023 Herman Rimm <herman@rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -3656,6 +3657,54 @@  (define-public python-pyqt
 contain over 620 classes.")
     (license license:gpl3)))
 
+(define-public python-pyqt-6
+  (package
+    (inherit python-pyqt)
+    (version "6.5.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "PyQt6" version))
+       (file-name (string-append "PyQt6-" version ".tar.gz"))
+       (sha256
+        (base32
+         "100jh1iiz5gx821qzgicfrqv7hjjj98pchdbc1nvdzzra1ryx1ql"))))
+    (inputs ; Qt5 dependencies only in python-pyqt:
+     ; (qt)connectivity, location, sensors, serialport, x11extras, xmlpatterns.
+     `(("python" ,python-wrapper)
+       ("qtbase" ,qtbase)
+       ("qtdeclarative" ,qtdeclarative)
+       ("qtmultimedia" ,qtmultimedia)
+       ("qtpositioning" ,qtpositioning)
+       ("qtsvg" ,qtsvg)
+       ("qttools" ,qttools)
+       ("qtwebchannel" ,qtwebchannel)
+       ("qtwebsockets" ,qtwebsockets)))
+    (propagated-inputs
+     (list python-sip python-pyqt6-sip))
+    (native-inputs
+     (list python-pyqt-builder
+           qtbase))                     ;for qmake
+    (arguments
+      (list
+       #:tests? #f ; No tests.
+       #:configure-flags
+       #~`(@ ("--verbose" . "") ; Print commands run.
+             ("--confirm-license" . "")
+             ("--jobs" . ,(number->string (parallel-job-count))))
+       #:phases
+       #~(modify-phases %standard-phases
+         ;; When building python-pyqtwebengine, <qprinter.h> can not be
+         ;; included.  Here we substitute the full path to the header in the
+         ;; store.
+         (add-after 'unpack 'substitute-source
+           (lambda* (#:key inputs  #:allow-other-keys)
+             (let* ((qtbase (assoc-ref inputs "qtbase"))
+                    (qtprinter.h (string-append "\"" qtbase "/include/qt6/QtPrintSupport/qprinter.h\"")))
+               (substitute* (list "sip/QtPrintSupport/qprinter.sip"
+                                  "sip/QtPrintSupport/qpyprintsupport_qlist.sip")
+                 (("<qprinter.h>") qtprinter.h))))))))))
+
 (define-public python-pyqt5-sip
   (package
     (name "python-pyqt5-sip")