From 0856c6efcd09be2a5326af457b01f994c954d959 Mon Sep 17 00:00:00 2001 From: Zhu Zihao 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 + ;; /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)$") + (("") + 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