diff mbox series

[bug#57431] : Add PyQt 6.

Message ID 865yifjbu2.fsf@163.com
State New
Headers show
Series [bug#57431] : Add PyQt 6. | expand

Checks

Context Check Description
cbaines/applying patch fail
cbaines/issue success View issue
cbaines/applying patch fail
cbaines/issue success View issue
cbaines/applying patch fail
cbaines/issue success View issue
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Zhu Zihao Aug. 26, 2022, 2:50 p.m. UTC

Comments

ROCKTAKEY April 13, 2023, 3:04 p.m. UTC | #1
Hi, it looks great. I would like to use PyQt 6.

Is there any progress? I want help if there is some problem.

ROCKTAKEY
Zhu Zihao April 16, 2023, 2:16 a.m. UTC | #2
ROCKTAKEY <rocktakey@gmail.com> writes:

> Hi, it looks great. I would like to use PyQt 6.

If you just wanna programming with Python and Qt, you can use qtpy and
pyside-6 :)

>
> Is there any progress? I want help if there is some problem.

The problem is, the sip of PyQt 6 prefer the qmake way rather than CMake
way like PySide6. but the qmake definition file of Qt6 is broken.(Ok,
plz see the XXX comment of pyqt-webengine in previos patch...)
Herman Rimm Nov. 19, 2023, 3:15 p.m. UTC | #3
Hello, only patch 1 can be applied sucessfully: python-sip and
python-pyqt-builder are already updated, so patch 6 and 7 don't apply;
patches 2, 3, 4 and 5 do renames and touch a lot of code, which has
changed since patch creation; patch 8 and 9 can't be applied without the
renames.

I have modified patch 8 and 9 and made a patch series from patches 1, 8
and 9. It should easier to apply than the longer patch series. I have
not tested or cross-compiled any of the packages, only built them
natively. Probably some (native-)inputs can be removed or need to be
added.

As for the renames, there are many Qt5 package symbols without a '-5'
suffix. Some rename patches touch a lot of files and get outdated
quickly. Can they be contributed some other way? For example:

1. run the rename scripts;
2. write a commit message for the changes;
3. send the commit as a patch to a maintainer via IRC/Matrix;
4. the maintainer applies the patch and pushes to remote;
5. repeat steps 1-4 until it is pushed sucessfully.

Cheers,
Herman Rimm
chris Nov. 30, 2023, 9:50 a.m. UTC | #4
bumping this to please bring PyQt 6 and the latest version of qutebrowser!
diff mbox series

Patch

From 0856c6efcd09be2a5326af457b01f994c954d959 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Fri, 26 Aug 2022 22:32:24 +0800
Subject: [PATCH 9/9] gnu: Add python-pyqtwebengine, version 6.3.1.

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

diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index ac575c9828..821e824e36 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -3162,6 +3162,110 @@  (define-public python-pyqt6-sip
     (synopsis "Sip module support for PyQt6")
     (description "Sip module support for PyQt6")))
 
+(define-public python-pyqtwebengine
+  (package
+    (name "python-pyqtwebengine")
+    (version "6.3.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "PyQt6_WebEngine" version))
+       (sha256
+        (base32
+         "01zhx1yz8ggi6n9rwqi1z18aznbl3ndwa5yn090z85abgd9gblf3"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     (list python
+           python-sip
+           python-pyqt-builder
+           ;; qtbase is required for qmake
+           qtbase))
+    (inputs
+     (list python-pyqt
+           qtbase
+           qtdeclarative
+           qtwebchannel
+           qtwebengine))
+    (arguments
+     (list
+      #:imported-modules `((guix build python-build-system)
+                           ,@%gnu-build-system-modules)
+      #:modules
+      `((ice-9 regex)
+        ((guix build python-build-system)
+         #:select (site-packages python-version))
+        ,@%gnu-build-system-modules)
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-before 'configure 'fix-pyqt-sip-dirs
+            (lambda _
+              (define sip-dir
+                (string-append
+                 #$(this-package-input "python-pyqt")
+                 "/lib/python"
+                 (python-version #$(this-package-native-input "python"))
+                 "/site-packages/PyQt6/bindings"))
+
+              (substitute* "pyproject.toml"
+                (("tool\\.sip\\.project.+$" all)
+                 (format #f "~asip-include-dirs = [\"~a\"]~%"
+                         all sip-dir)))))
+          (replace 'configure
+            (lambda* (#:key inputs native-inputs outputs #:allow-other-keys)
+              (invoke "sip-build"
+                      "--verbose"
+                      "--no-make"
+                      "--target-dir" (site-packages inputs outputs))))
+          ;; XXX: qmake generates Makefile that tries to link with
+          ;; <path-to-qtbase>/lib/libQt6Qml.so. This phase deletes these
+          ;; bad references.
+          (add-after 'configure 'delete-bad-references
+            (lambda* (#:key inputs #:allow-other-keys)
+              (substitute* '("build/QtWebEngineCore/Makefile"
+                             "build/QtWebEngineQuick/Makefile"
+                             "build/QtWebEngineWidgets/Makefile")
+                (((string-append
+                   (regexp-quote #$(this-package-input "qtbase"))
+                   "/lib/libQt6(Qml|QmlModels|WebEngineCore)\\.so"))
+                 ""))))
+          (add-after 'configure 'absolutize-qprinter.h
+            (lambda* (#:key inputs  #:allow-other-keys)
+              (let* ((qtprinter.h
+                      (string-append
+                       "\""
+                       (search-input-file
+                        inputs
+                        "include/qt6/QtPrintSupport/qprinter.h")
+                       "\"")))
+                (substitute* (find-files "build/QtWebEngineWidgets"
+                                         "\\.(cpp|h)$")
+                  (("<qprinter.h>")
+                   qtprinter.h))
+                #t)))
+          (add-before 'build 'enter-build-directory
+            (lambda _ (chdir "build") #t))
+          (add-after 'install 'leave-build-directory
+            (lambda _ (chdir "..") #t))
+          (add-after 'install 'make-namespace
+            (lambda* (#:key inputs outputs #:allow-other-keys)
+              (let* ((init (string-append
+                            (site-packages inputs outputs)
+                            "/PyQt6/__init__.py")))
+                (with-output-to-file init
+                  (lambda _
+                    (display "\
+from pkgutil import extend_path
+__path__ = extend_path(__path__, __name__)
+")))
+                #t))))))
+    (home-page "https://www.riverbankcomputing.com/software/pyqtwebengine/intro")
+    (synopsis "Python bindings for QtWebEngine6")
+    (description
+     "PyQtWebEngine is a set of Python bindings for The Qt Company's Qt
+WebEngine libraries.  The bindings sit on top of PyQt6 and are implemented as a
+set of three modules.")
+    (license license:gpl3)))
+
 (define-public python-pyqtwebengine-5
   (package
     (name "python-pyqtwebengine")
-- 
2.37.2