unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#57398] [PATCH]: Add PySide 6.
@ 2022-08-25  5:38 Zhu Zihao
       [not found] ` <handler.57398.B.166140611521962.ack@debbugs.gnu.org>
  2022-09-07 17:51 ` bug#57398: [PATCH]: Add PySide 6 Marius Bakke
  0 siblings, 2 replies; 5+ messages in thread
From: Zhu Zihao @ 2022-08-25  5:38 UTC (permalink / raw)
  To: 57398

[-- Attachment #1: 0001-gnu-python-shiboken-2-Use-G-expressions.patch --]
[-- Type: text/x-patch, Size: 4102 bytes --]

From bbfc717a19c272d1f2698bca44e72109cbe1d3cf Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Wed, 24 Aug 2022 16:50:14 +0800
Subject: [PATCH 1/9] gnu: python-shiboken-2: Use G-expressions.

* gnu/packages/qt.scm (python-shiboken-2)[arguments]: Use G-expressions.
<#:phases>: In phase "set-build-env", Replace (assoc-ref inputs ...) with
(this-package-input ...).
---
 gnu/packages/qt.scm | 53 +++++++++++++++++++++++++--------------------
 1 file changed, 29 insertions(+), 24 deletions(-)

diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index d9d796f551..fe9c9213e5 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -24,6 +24,7 @@
 ;;; Copyright © 2021, 2022 Guillaume Le Vaillant <glv@posteo.net>
 ;;; Copyright © 2021 Nicolò Balzarotti <nicolo@nixo.xyz>
 ;;; Copyright © 2022 Foo Chuan Wei <chuanwei.foo@hotmail.com>
+;;; Copyright © 2022 Zhu Zihao <all_but_last@163.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -3746,6 +3747,9 @@ (define-public qcustomplot
      "QCustomPlot is a Qt C++ widget providing 2D plots, graphs and charts.")
     (license license:gpl3+)))
 
+;; TODO: Split shiboken2 binding generator into a dedicated output.
+;; This executable requires libxml2, libxslt, clang-toolchain at runtime.
+;; The libshiboken library only requires Qt and Python at runtime.
 (define-public python-shiboken-2
   (package
     (name "python-shiboken-2")
@@ -3768,30 +3772,31 @@ (define-public python-shiboken-2
            qtbase-5
            qtxmlpatterns))
     (arguments
-     `(#:tests? #f
-       ;; FIXME: Building tests fails
-       #:configure-flags '("-DBUILD_TESTS=off")
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'use-shiboken-dir-only
-           (lambda _ (chdir "sources/shiboken2") #t))
-         (add-before 'configure 'make-files-writable-and-update-timestamps
-           (lambda _
-             ;; The build scripts need to modify some files in
-             ;; the read-only source directory, and also attempts
-             ;; to create Zip files which fails because the Zip
-             ;; format does not support timestamps before 1980.
-             (let ((circa-1980 (* 10 366 24 60 60)))
-               (for-each (lambda (file)
-                           (make-file-writable file)
-                           (utime file circa-1980 circa-1980))
-                         (find-files ".")))
-             #t))
-         (add-before 'configure 'set-build-env
-           (lambda* (#:key inputs #:allow-other-keys)
-             (let ((llvm (assoc-ref inputs "clang-toolchain")))
-               (setenv "CLANG_INSTALL_DIR" llvm)
-               #t))))))
+     (list
+      #:tests? #f
+      ;; FIXME: Building tests fails
+      #:configure-flags #~(list "-DBUILD_TESTS=off")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'use-shiboken-dir-only
+            (lambda _ (chdir "sources/shiboken2") #t))
+          (add-before 'configure 'make-files-writable-and-update-timestamps
+            (lambda _
+              ;; The build scripts need to modify some files in
+              ;; the read-only source directory, and also attempts
+              ;; to create Zip files which fails because the Zip
+              ;; format does not support timestamps before 1980.
+              (let ((circa-1980 (* 10 366 24 60 60)))
+                (for-each (lambda (file)
+                            (make-file-writable file)
+                            (utime file circa-1980 circa-1980))
+                          (find-files ".")))
+              #t))
+          (add-before 'configure 'set-build-env
+            (lambda _
+              (let ((llvm #$(this-package-input "clang-toolchain")))
+                (setenv "CLANG_INSTALL_DIR" llvm)
+                #t))))))
     (home-page "https://wiki.qt.io/Qt_for_Python")
     (synopsis
      "Shiboken generates bindings for C++ libraries using CPython source code")
-- 
2.37.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-gnu-Add-python-shiboken-6.patch --]
[-- Type: text/x-patch, Size: 2062 bytes --]

From 1f1e9b864581544be3fb2e5281a5182826538807 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Wed, 24 Aug 2022 19:23:31 +0800
Subject: [PATCH 2/9] gnu: Add python-shiboken-6

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

diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index fe9c9213e5..7e303a929c 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -3810,6 +3810,40 @@ (define-public python-shiboken-2
       license:lgpl3
       license:bsd-3))))
 
+(define-public python-shiboken-6
+  (package
+    (inherit python-shiboken-2)
+    (name "python-shiboken-6")
+    (version "6.3.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://download.qt.io/official_releases"
+                                  "/QtForPython/pyside6/PySide6-" version
+                                  "-src/pyside-setup-opensource-src-"
+                                  version ".tar.xz"))
+              (sha256
+               (base32
+                "0xwri69nnbhn6fajm7l045r0s0qv8nlq6qj8wcj87srli3b5xa75"))))
+    (build-system cmake-build-system)
+    (inputs
+     (modify-inputs (package-inputs python-shiboken-2)
+       (replace "qtbase" qtbase)
+       (delete "qtxmlpatterns")))
+    (arguments
+     (substitute-keyword-arguments (package-arguments python-shiboken-2)
+       ((#:phases p)
+        #~(modify-phases #$p
+            (replace 'use-shiboken-dir-only
+              (lambda _ (chdir "sources/shiboken6") #t))))
+       ((#:configure-flags flags)
+        #~(cons*
+           ;; The RUNPATH of shibokenmodule contains the entry in build
+           ;; directory instead of install directory.
+           "-DCMAKE_SKIP_RPATH=TRUE"
+           (string-append "-DCMAKE_MODULE_LINKER_FLAGS=-Wl,-rpath="
+                          #$output "/lib")
+           #$flags))))))
+
 (define-public python-pyside-2
   (package
     (name "python-pyside-2")
-- 
2.37.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0003-gnu-python-pyside-2-Use-G-expressions.patch --]
[-- Type: text/x-patch, Size: 6615 bytes --]

From a4d31ffc721fa3b459e2f168cb4af65147b82248 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Wed, 24 Aug 2022 19:25:26 +0800
Subject: [PATCH 3/9] gnu: python-pyside-2: Use G-expressions.

* gnu/packages/qt.scm (python-pyside-2)[native-inputs]: Use label-less input
style.
[arguments]: Use G-expressions.
---
 gnu/packages/qt.scm | 116 ++++++++++++++++++++++----------------------
 1 file changed, 57 insertions(+), 59 deletions(-)

diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index 7e303a929c..3f53f22363 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -3874,68 +3874,66 @@ (define-public python-pyside-2
     (propagated-inputs
      (list python-shiboken-2))
     (native-inputs
-     `(("cmake" ,cmake-minimal)
-       ("python" ,python-wrapper)
-       ("qttools-5" ,qttools-5)
-       ("which" ,which)))
+     (list cmake-minimal python-wrapper qttools-5 which))
     (arguments
-     `(#:tests? #f
-       ;; FIXME: Building tests fail.
-       #:configure-flags
-       (list "-DBUILD_TESTS=FALSE"
-             (string-append "-DPYTHON_EXECUTABLE="
-                            (assoc-ref %build-inputs "python")
-                            "/bin/python"))
-       #:modules ((guix build cmake-build-system)
+     (list
+      #:tests? #f
+      ;; FIXME: Building tests fail.
+      #:configure-flags
+      #~(list "-DBUILD_TESTS=FALSE"
+              (string-append "-DPYTHON_EXECUTABLE="
+                             (assoc-ref %build-inputs "python")
+                             "/bin/python"))
+      #:modules '((guix build cmake-build-system)
                   (guix build utils)
                   (srfi srfi-1))
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'go-to-source-dir
-           (lambda _ (chdir "sources/pyside2") #t))
-         (add-after 'go-to-source-dir 'fix-qt-module-detection
-           (lambda* (#:key inputs #:allow-other-keys)
-             ;; Activate qt module support even if it not in the same
-             ;; directory as qtbase.
-             (substitute* "../cmake_helpers/helpers.cmake"
-               (("\\(\"\\$\\{found_basepath\\}\" GREATER \"0\"\\)")
-                "true"))
-             ;; Add include directories for qt modules.
-             (let ((dirs (map (lambda (name)
-                                (string-append (assoc-ref inputs name)
-                                               "/include/qt5"))
-                              '("qtdatavis3d"
-                                "qtdeclarative"
-                                "qtlocation"
-                                "qtmultimedia"
-                                "qtquickcontrols"
-                                "qtquickcontrols2"
-                                "qtscript"
-                                "qtscxml"
-                                "qtsensors"
-                                "qtspeech"
-                                "qtsvg"
-                                "qttools-5"
-                                "qtwebchannel"
-                                "qtwebengine"
-                                "qtwebsockets"
-                                "qtx11extras"
-                                "qtxmlpatterns"))))
-               (substitute* "cmake/Macros/PySideModules.cmake"
-                 (("\\$\\{PATH_SEP\\}\\$\\{core_includes\\}" all)
-                  (fold (lambda (dir paths)
-                          (string-append paths "${PATH_SEP}" dir))
-                        all
-                        dirs)))
-               (setenv "CXXFLAGS" (fold (lambda (dir paths)
-                                          (string-append paths " -I" dir))
-                                        ""
-                                        dirs)))))
-         (add-before 'configure 'set-clang-dir
-           (lambda* (#:key inputs #:allow-other-keys)
-             (let ((clang (assoc-ref inputs "clang-toolchain")))
-               (setenv "CLANG_INSTALL_DIR" clang)
-               #t))))))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'go-to-source-dir
+            (lambda _ (chdir "sources/pyside2") #t))
+          (add-after 'go-to-source-dir 'fix-qt-module-detection
+            (lambda* (#:key inputs #:allow-other-keys)
+              ;; Activate qt module support even if it not in the same
+              ;; directory as qtbase.
+              (substitute* "../cmake_helpers/helpers.cmake"
+                (("\\(\"\\$\\{found_basepath\\}\" GREATER \"0\"\\)")
+                 "true"))
+              ;; Add include directories for qt modules.
+              (let ((dirs (map (lambda (name)
+                                 (string-append (assoc-ref inputs name)
+                                                "/include/qt5"))
+                               '("qtdatavis3d"
+                                 "qtdeclarative"
+                                 "qtlocation"
+                                 "qtmultimedia"
+                                 "qtquickcontrols"
+                                 "qtquickcontrols2"
+                                 "qtscript"
+                                 "qtscxml"
+                                 "qtsensors"
+                                 "qtspeech"
+                                 "qtsvg"
+                                 "qttools-5"
+                                 "qtwebchannel"
+                                 "qtwebengine"
+                                 "qtwebsockets"
+                                 "qtx11extras"
+                                 "qtxmlpatterns"))))
+                (substitute* "cmake/Macros/PySideModules.cmake"
+                  (("\\$\\{PATH_SEP\\}\\$\\{core_includes\\}" all)
+                   (fold (lambda (dir paths)
+                           (string-append paths "${PATH_SEP}" dir))
+                         all
+                         dirs)))
+                (setenv "CXXFLAGS" (fold (lambda (dir paths)
+                                           (string-append paths " -I" dir))
+                                         ""
+                                         dirs)))))
+          (add-before 'configure 'set-clang-dir
+            (lambda* (#:key inputs #:allow-other-keys)
+              (let ((clang (assoc-ref inputs "clang-toolchain")))
+                (setenv "CLANG_INSTALL_DIR" clang)
+                #t))))))
     (home-page "https://wiki.qt.io/Qt_for_Python")
     (synopsis
      "The Qt for Python product enables the use of Qt5 APIs in Python applications")
-- 
2.37.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0004-gnu-python-pyside-2-Clarify-the-package-inputs.patch --]
[-- Type: text/x-patch, Size: 2451 bytes --]

From 3d1db3ee35d31414e2d4ef40ad5fcffa60a1e7b4 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Wed, 24 Aug 2022 22:54:46 +0800
Subject: [PATCH 4/9] gnu: python-pyside-2: Clarify the package inputs.

The module "PySide.PyQtUiTools" depends on "qttools-5", it should be an input,
not a native input.

libxml2, libxslt, clang-toolchain is only used by python-shiboken-2.

cmake-minimal is not used.

* gnu/packages/qt.scm (python-pyside-2): [inputs]: Remove libxml2, libxslt,
clang-toolchain. Add qttools-5.
[native-inputs]: Remove cmake-minimal, qttools-5.
[arguments]<#:phases>: Remove phase "set-clang-dir".
---
 gnu/packages/qt.scm | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index 3f53f22363..dd1e2d4640 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -3851,10 +3851,7 @@ (define-public python-pyside-2
     (source (package-source python-shiboken-2))
     (build-system cmake-build-system)
     (inputs
-     (list libxml2
-           libxslt
-           clang-toolchain
-           qtbase-5
+     (list qtbase-5
            qtdatavis3d
            qtdeclarative-5
            qtlocation
@@ -3866,6 +3863,7 @@ (define-public python-pyside-2
            qtsensors
            qtspeech
            qtsvg-5
+           qttools-5
            qtwebchannel-5
            qtwebengine-5
            qtwebsockets-5
@@ -3874,7 +3872,7 @@ (define-public python-pyside-2
     (propagated-inputs
      (list python-shiboken-2))
     (native-inputs
-     (list cmake-minimal python-wrapper qttools-5 which))
+     (list python-wrapper))
     (arguments
      (list
       #:tests? #f
@@ -3928,12 +3926,7 @@ (define-public python-pyside-2
                 (setenv "CXXFLAGS" (fold (lambda (dir paths)
                                            (string-append paths " -I" dir))
                                          ""
-                                         dirs)))))
-          (add-before 'configure 'set-clang-dir
-            (lambda* (#:key inputs #:allow-other-keys)
-              (let ((clang (assoc-ref inputs "clang-toolchain")))
-                (setenv "CLANG_INSTALL_DIR" clang)
-                #t))))))
+                                         dirs))))))))
     (home-page "https://wiki.qt.io/Qt_for_Python")
     (synopsis
      "The Qt for Python product enables the use of Qt5 APIs in Python applications")
-- 
2.37.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: 0005-gnu-python-pyside-2-Use-this-package-input-instead-o.patch --]
[-- Type: text/x-patch, Size: 4198 bytes --]

From 801e4315b1ef24fc18cf61169b42443eb221e924 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Wed, 24 Aug 2022 22:57:44 +0800
Subject: [PATCH 5/9] gnu: python-pyside-2: Use "this-package-input" instead of
 "assoc-ref".

* gnu/packages/qt.scm (python-pyside-2)[arguments]<#:configure-flags>: Use
"this-package-input"
<#:phases>: In phase "fix-qt-module-detection", use "this-package-input".
---
 gnu/packages/qt.scm | 46 +++++++++++++++++++++++----------------------
 1 file changed, 24 insertions(+), 22 deletions(-)

diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index dd1e2d4640..bc16f69e60 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -3880,7 +3880,7 @@ (define-public python-pyside-2
       #:configure-flags
       #~(list "-DBUILD_TESTS=FALSE"
               (string-append "-DPYTHON_EXECUTABLE="
-                             (assoc-ref %build-inputs "python")
+                             #$(this-package-native-input "python-wrapper")
                              "/bin/python"))
       #:modules '((guix build cmake-build-system)
                   (guix build utils)
@@ -3890,33 +3890,35 @@ (define-public python-pyside-2
           (add-after 'unpack 'go-to-source-dir
             (lambda _ (chdir "sources/pyside2") #t))
           (add-after 'go-to-source-dir 'fix-qt-module-detection
-            (lambda* (#:key inputs #:allow-other-keys)
+            (lambda _
               ;; Activate qt module support even if it not in the same
               ;; directory as qtbase.
               (substitute* "../cmake_helpers/helpers.cmake"
                 (("\\(\"\\$\\{found_basepath\\}\" GREATER \"0\"\\)")
                  "true"))
               ;; Add include directories for qt modules.
-              (let ((dirs (map (lambda (name)
-                                 (string-append (assoc-ref inputs name)
-                                                "/include/qt5"))
-                               '("qtdatavis3d"
-                                 "qtdeclarative"
-                                 "qtlocation"
-                                 "qtmultimedia"
-                                 "qtquickcontrols"
-                                 "qtquickcontrols2"
-                                 "qtscript"
-                                 "qtscxml"
-                                 "qtsensors"
-                                 "qtspeech"
-                                 "qtsvg"
-                                 "qttools-5"
-                                 "qtwebchannel"
-                                 "qtwebengine"
-                                 "qtwebsockets"
-                                 "qtx11extras"
-                                 "qtxmlpatterns"))))
+              (let ((dirs (map (lambda (path)
+                                 (string-append path "/include/qt5"))
+                               (list
+                                #$@(map (lambda (name)
+                                          (this-package-input name))
+                                        '("qtdatavis3d"
+                                          "qtdeclarative"
+                                          "qtlocation"
+                                          "qtmultimedia"
+                                          "qtquickcontrols"
+                                          "qtquickcontrols2"
+                                          "qtscript"
+                                          "qtscxml"
+                                          "qtsensors"
+                                          "qtspeech"
+                                          "qtsvg"
+                                          "qttools"
+                                          "qtwebchannel"
+                                          "qtwebengine"
+                                          "qtwebsockets"
+                                          "qtx11extras"
+                                          "qtxmlpatterns"))))))
                 (substitute* "cmake/Macros/PySideModules.cmake"
                   (("\\$\\{PATH_SEP\\}\\$\\{core_includes\\}" all)
                    (fold (lambda (dir paths)
-- 
2.37.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: 0006-gnu-Add-python-pyside-6.patch --]
[-- Type: text/x-patch, Size: 3809 bytes --]

From 1b1d4b2a22638aca688a9f35572b82c9dc649d1f Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Thu, 25 Aug 2022 12:42:54 +0800
Subject: [PATCH 6/9] gnu: Add python-pyside-6.

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

diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index bc16f69e60..0d1d6124d4 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -3950,6 +3950,78 @@ (define-public python-pyside-2
               license:gpl3
               license:gpl2))))
 
+(define-public python-pyside-6
+  (package
+    (inherit python-pyside-2)
+    (name "python-pyside-6")
+    (version (package-version python-shiboken-6))
+    (source (package-source python-shiboken-6))
+    ;; TODO: Add more Qt components if available.
+    (inputs
+     (list qtbase
+           qtdeclarative
+           qtmultimedia
+           qtnetworkauth
+           qtpositioning
+           qtsvg
+           qttools
+           qtwebchannel
+           qtwebengine
+           qtwebsockets))
+    (propagated-inputs
+     (list python-shiboken-6))
+    (native-inputs
+     (list python-wrapper))
+    (arguments
+     (list
+      #:tests? #f
+      #:configure-flags
+      #~(list "-DBUILD_TESTS=FALSE"
+              (string-append "-DPYTHON_EXECUTABLE="
+                             #$(this-package-native-input "python-wrapper")
+                             "/bin/python"))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'go-to-source-dir
+            (lambda _ (chdir "sources/pyside6") #t))
+          (add-after 'go-to-source-dir 'fix-qt-module-detection
+            (lambda _
+              (substitute* "cmake/PySideHelpers.cmake"
+                (("\\(\"\\$\\{found_basepath\\}\" GREATER \"0\"\\)")
+                 "true"))
+              (let ((dirs (map (lambda (path)
+                                 (string-append path "/include/qt6"))
+                               (list
+                                #$@(map (lambda (name)
+                                          (this-package-input name))
+                                        '("qtdeclarative"
+                                          "qtmultimedia"
+                                          "qtnetworkauth"
+                                          "qtpositioning"
+                                          "qtsvg"
+                                          "qttools"
+                                          "qtwebchannel"
+                                          "qtwebengine"
+                                          "qtwebsockets"))))))
+                (substitute* "cmake/Macros/PySideModules.cmake"
+                  (("set\\(shiboken_include_dir_list " all)
+                   (string-append all (string-join dirs ";") " ")))
+                (setenv "CXXFLAGS"
+                        (string-join
+                         (map (lambda (dir)
+                                (string-append "-I" dir))
+                              dirs)
+                         " "))))))))
+    (synopsis
+     "The Qt for Python product enables the use of Qt6 APIs in Python applications")
+    (description
+     "The Qt for Python product enables the use of Qt6 APIs in Python
+applications.  It lets Python developers utilize the full potential of Qt,
+using the PySide6 module.  The PySide6 module provides access to the
+individual Qt modules such as QtCore, QtGui,and so on.  Qt for Python also
+comes with the Shiboken6 CPython binding code generator, which can be used to
+generate Python bindings for your C or C++ code.")))
+
 (define-public python-pyside-2-tools
   (package
     (name "python-pyside-2-tools")
-- 
2.37.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #7: 0007-gnu-python-pyside-2-tools-Use-G-expressions.patch --]
[-- Type: text/x-patch, Size: 1848 bytes --]

From f3fffdcfd6635399418073e4bb6bf884a685d5d7 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Thu, 25 Aug 2022 13:02:46 +0800
Subject: [PATCH 7/9] gnu: python-pyside-2-tools: Use G-expressions.

* gnu/packages/qt.scm (python-pyside2-tools)[native-inputs]: Use label-less
style.
[arguments]: Use G-expressions.
<#:configure-flags>: Use "this-package-native-input".
---
 gnu/packages/qt.scm | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index 0d1d6124d4..e1bda580ad 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -4031,17 +4031,19 @@ (define-public python-pyside-2-tools
     (inputs
      (list python-pyside-2 python-shiboken-2 qtbase-5))
     (native-inputs
-     `(("python" ,python-wrapper)))
+     (list python-wrapper))
     (arguments
-     `(#:tests? #f
-       #:configure-flags
-       (list "-DBUILD_TESTS=off"
-             (string-append "-DPYTHON_EXECUTABLE="
-                            (assoc-ref %build-inputs "python")
-                            "/bin/python"))
-       #:phases (modify-phases %standard-phases
-                  (add-after 'unpack 'go-to-source-dir
-                    (lambda _ (chdir "sources/pyside2-tools") #t)))))
+     (list
+      #:tests? #f
+      #:configure-flags
+      #~(list "-DBUILD_TESTS=off"
+              (string-append "-DPYTHON_EXECUTABLE="
+                             #$(this-package-native-inputs "python-wrapper")
+                             "/bin/python"))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'go-to-source-dir
+            (lambda _ (chdir "sources/pyside2-tools") #t)))))
     (home-page "https://wiki.qt.io/Qt_for_Python")
     (synopsis
      "Contains command line tools for PySide2")
-- 
2.37.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #8: 0008-gnu-python-pyside-2-tools-Fix-synopsis-and-descripti.patch --]
[-- Type: text/x-patch, Size: 1066 bytes --]

From 2669f1f0dd7a2688f0dcaf913649a24640a68f7c Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Thu, 25 Aug 2022 13:04:45 +0800
Subject: [PATCH 8/9] gnu: python-pyside-2-tools: Fix synopsis and description.

* gnu/packages/qt.scm (python-pyside2-tools)[synopsis]: Use more descriptive
words.
[description]: Ditto.
---
 gnu/packages/qt.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index e1bda580ad..84550872b1 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -4046,9 +4046,9 @@ (define-public python-pyside-2-tools
             (lambda _ (chdir "sources/pyside2-tools") #t)))))
     (home-page "https://wiki.qt.io/Qt_for_Python")
     (synopsis
-     "Contains command line tools for PySide2")
+     "Command line tools for PySide2")
     (description
-     "Contains lupdate, rcc and uic tools for PySide2")
+     "Python-pyside-2-tools contains lupdate, rcc and uic tools for PySide2")
     (license license:gpl2)))
 
 (define-public libqglviewer
-- 
2.37.2


[-- Attachment #9: Type: text/plain, Size: 99 bytes --]

-- 
Retrieve my PGP public key:

  gpg --recv-keys 481F5EEEBA425ADC13247C76A6E672D981B8E744

Zihao

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [bug#57398] Acknowledgement ([PATCH]: Add PySide 6.)
       [not found] ` <handler.57398.B.166140611521962.ack@debbugs.gnu.org>
@ 2022-08-25 10:30   ` Zhu Zihao
  2022-08-30  8:51     ` Zhu Zihao
  0 siblings, 1 reply; 5+ messages in thread
From: Zhu Zihao @ 2022-08-25 10:30 UTC (permalink / raw)
  To: 57398

[-- Attachment #1: Type: text/plain, Size: 17 bytes --]

Patches updated


[-- Attachment #2: 0001-gnu-python-shiboken-2-Use-G-expressions.patch --]
[-- Type: text/x-patch, Size: 4102 bytes --]

From bbfc717a19c272d1f2698bca44e72109cbe1d3cf Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Wed, 24 Aug 2022 16:50:14 +0800
Subject: [PATCH 1/9] gnu: python-shiboken-2: Use G-expressions.

* gnu/packages/qt.scm (python-shiboken-2)[arguments]: Use G-expressions.
<#:phases>: In phase "set-build-env", Replace (assoc-ref inputs ...) with
(this-package-input ...).
---
 gnu/packages/qt.scm | 53 +++++++++++++++++++++++++--------------------
 1 file changed, 29 insertions(+), 24 deletions(-)

diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index d9d796f551..fe9c9213e5 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -24,6 +24,7 @@
 ;;; Copyright © 2021, 2022 Guillaume Le Vaillant <glv@posteo.net>
 ;;; Copyright © 2021 Nicolò Balzarotti <nicolo@nixo.xyz>
 ;;; Copyright © 2022 Foo Chuan Wei <chuanwei.foo@hotmail.com>
+;;; Copyright © 2022 Zhu Zihao <all_but_last@163.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -3746,6 +3747,9 @@ (define-public qcustomplot
      "QCustomPlot is a Qt C++ widget providing 2D plots, graphs and charts.")
     (license license:gpl3+)))
 
+;; TODO: Split shiboken2 binding generator into a dedicated output.
+;; This executable requires libxml2, libxslt, clang-toolchain at runtime.
+;; The libshiboken library only requires Qt and Python at runtime.
 (define-public python-shiboken-2
   (package
     (name "python-shiboken-2")
@@ -3768,30 +3772,31 @@ (define-public python-shiboken-2
            qtbase-5
            qtxmlpatterns))
     (arguments
-     `(#:tests? #f
-       ;; FIXME: Building tests fails
-       #:configure-flags '("-DBUILD_TESTS=off")
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'use-shiboken-dir-only
-           (lambda _ (chdir "sources/shiboken2") #t))
-         (add-before 'configure 'make-files-writable-and-update-timestamps
-           (lambda _
-             ;; The build scripts need to modify some files in
-             ;; the read-only source directory, and also attempts
-             ;; to create Zip files which fails because the Zip
-             ;; format does not support timestamps before 1980.
-             (let ((circa-1980 (* 10 366 24 60 60)))
-               (for-each (lambda (file)
-                           (make-file-writable file)
-                           (utime file circa-1980 circa-1980))
-                         (find-files ".")))
-             #t))
-         (add-before 'configure 'set-build-env
-           (lambda* (#:key inputs #:allow-other-keys)
-             (let ((llvm (assoc-ref inputs "clang-toolchain")))
-               (setenv "CLANG_INSTALL_DIR" llvm)
-               #t))))))
+     (list
+      #:tests? #f
+      ;; FIXME: Building tests fails
+      #:configure-flags #~(list "-DBUILD_TESTS=off")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'use-shiboken-dir-only
+            (lambda _ (chdir "sources/shiboken2") #t))
+          (add-before 'configure 'make-files-writable-and-update-timestamps
+            (lambda _
+              ;; The build scripts need to modify some files in
+              ;; the read-only source directory, and also attempts
+              ;; to create Zip files which fails because the Zip
+              ;; format does not support timestamps before 1980.
+              (let ((circa-1980 (* 10 366 24 60 60)))
+                (for-each (lambda (file)
+                            (make-file-writable file)
+                            (utime file circa-1980 circa-1980))
+                          (find-files ".")))
+              #t))
+          (add-before 'configure 'set-build-env
+            (lambda _
+              (let ((llvm #$(this-package-input "clang-toolchain")))
+                (setenv "CLANG_INSTALL_DIR" llvm)
+                #t))))))
     (home-page "https://wiki.qt.io/Qt_for_Python")
     (synopsis
      "Shiboken generates bindings for C++ libraries using CPython source code")
-- 
2.37.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-gnu-Add-python-shiboken-6.patch --]
[-- Type: text/x-patch, Size: 2062 bytes --]

From 1f1e9b864581544be3fb2e5281a5182826538807 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Wed, 24 Aug 2022 19:23:31 +0800
Subject: [PATCH 2/9] gnu: Add python-shiboken-6

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

diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index fe9c9213e5..7e303a929c 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -3810,6 +3810,40 @@ (define-public python-shiboken-2
       license:lgpl3
       license:bsd-3))))
 
+(define-public python-shiboken-6
+  (package
+    (inherit python-shiboken-2)
+    (name "python-shiboken-6")
+    (version "6.3.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://download.qt.io/official_releases"
+                                  "/QtForPython/pyside6/PySide6-" version
+                                  "-src/pyside-setup-opensource-src-"
+                                  version ".tar.xz"))
+              (sha256
+               (base32
+                "0xwri69nnbhn6fajm7l045r0s0qv8nlq6qj8wcj87srli3b5xa75"))))
+    (build-system cmake-build-system)
+    (inputs
+     (modify-inputs (package-inputs python-shiboken-2)
+       (replace "qtbase" qtbase)
+       (delete "qtxmlpatterns")))
+    (arguments
+     (substitute-keyword-arguments (package-arguments python-shiboken-2)
+       ((#:phases p)
+        #~(modify-phases #$p
+            (replace 'use-shiboken-dir-only
+              (lambda _ (chdir "sources/shiboken6") #t))))
+       ((#:configure-flags flags)
+        #~(cons*
+           ;; The RUNPATH of shibokenmodule contains the entry in build
+           ;; directory instead of install directory.
+           "-DCMAKE_SKIP_RPATH=TRUE"
+           (string-append "-DCMAKE_MODULE_LINKER_FLAGS=-Wl,-rpath="
+                          #$output "/lib")
+           #$flags))))))
+
 (define-public python-pyside-2
   (package
     (name "python-pyside-2")
-- 
2.37.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-gnu-python-pyside-2-Clarify-the-package-inputs.patch --]
[-- Type: text/x-patch, Size: 2570 bytes --]

From c60896bd5f5f1ca9dba38eae7fb3ef5b4f9cc996 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Thu, 25 Aug 2022 18:26:44 +0800
Subject: [PATCH 3/9] gnu: python-pyside-2: Clarify the package inputs.

The module "PySide.PyQtUiTools" depends on "qttools-5", it should be an input,
not a native input.

libxml2, libxslt, clang-toolchain is only used by python-shiboken-2.

cmake-minimal is not used.

* gnu/packages/qt.scm (python-pyside-2): [inputs]: Remove libxml2, libxslt,
clang-toolchain. Add qttools-5.
[native-inputs]: Use label-less input style.
Remove cmake-minimal, qttools-5.
[arguments]<#:phases>: Remove phase "set-clang-dir".
---
 gnu/packages/qt.scm | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index 7e303a929c..c56333ec08 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -3851,10 +3851,7 @@ (define-public python-pyside-2
     (source (package-source python-shiboken-2))
     (build-system cmake-build-system)
     (inputs
-     (list libxml2
-           libxslt
-           clang-toolchain
-           qtbase-5
+     (list qtbase-5
            qtdatavis3d
            qtdeclarative-5
            qtlocation
@@ -3866,6 +3863,7 @@ (define-public python-pyside-2
            qtsensors
            qtspeech
            qtsvg-5
+           qttools-5
            qtwebchannel-5
            qtwebengine-5
            qtwebsockets-5
@@ -3874,10 +3872,7 @@ (define-public python-pyside-2
     (propagated-inputs
      (list python-shiboken-2))
     (native-inputs
-     `(("cmake" ,cmake-minimal)
-       ("python" ,python-wrapper)
-       ("qttools-5" ,qttools-5)
-       ("which" ,which)))
+     (list python-wrapper))
     (arguments
      `(#:tests? #f
        ;; FIXME: Building tests fail.
@@ -3930,12 +3925,7 @@ (define-public python-pyside-2
                (setenv "CXXFLAGS" (fold (lambda (dir paths)
                                           (string-append paths " -I" dir))
                                         ""
-                                        dirs)))))
-         (add-before 'configure 'set-clang-dir
-           (lambda* (#:key inputs #:allow-other-keys)
-             (let ((clang (assoc-ref inputs "clang-toolchain")))
-               (setenv "CLANG_INSTALL_DIR" clang)
-               #t))))))
+                                        dirs))))))))
     (home-page "https://wiki.qt.io/Qt_for_Python")
     (synopsis
      "The Qt for Python product enables the use of Qt5 APIs in Python applications")
-- 
2.37.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: 0004-gnu-python-pyside-2-Use-G-expressions.patch --]
[-- Type: text/x-patch, Size: 6515 bytes --]

From d989a404a0199807ac648ebbec75a1686d6b6eca Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Wed, 24 Aug 2022 19:25:26 +0800
Subject: [PATCH 4/9] gnu: python-pyside-2: Use G-expressions.

* gnu/packages/qt.scm (python-pyside-2)[native-inputs]: Use label-less input
style.
[arguments]: Use G-expressions.
<#:configure-flags>: Use "this-package-native-input".
<#:phases>: In phase "fix-qt-module-detection", use "this-package-input".
---
 gnu/packages/qt.scm | 108 ++++++++++++++++++++++++--------------------
 1 file changed, 58 insertions(+), 50 deletions(-)

diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index c56333ec08..ce56efd0d8 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -3874,58 +3874,66 @@ (define-public python-pyside-2
     (native-inputs
      (list python-wrapper))
     (arguments
-     `(#:tests? #f
-       ;; FIXME: Building tests fail.
-       #:configure-flags
-       (list "-DBUILD_TESTS=FALSE"
-             (string-append "-DPYTHON_EXECUTABLE="
-                            (assoc-ref %build-inputs "python")
-                            "/bin/python"))
-       #:modules ((guix build cmake-build-system)
+     (list
+      #:tests? #f
+      ;; FIXME: Building tests fail.
+      #:configure-flags
+      #~(list "-DBUILD_TESTS=FALSE"
+              (string-append "-DPYTHON_EXECUTABLE="
+                             #$(this-package-native-input "python-wrapper")
+                             "/bin/python"))
+      #:modules '((guix build cmake-build-system)
                   (guix build utils)
                   (srfi srfi-1))
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'go-to-source-dir
-           (lambda _ (chdir "sources/pyside2") #t))
-         (add-after 'go-to-source-dir 'fix-qt-module-detection
-           (lambda* (#:key inputs #:allow-other-keys)
-             ;; Activate qt module support even if it not in the same
-             ;; directory as qtbase.
-             (substitute* "../cmake_helpers/helpers.cmake"
-               (("\\(\"\\$\\{found_basepath\\}\" GREATER \"0\"\\)")
-                "true"))
-             ;; Add include directories for qt modules.
-             (let ((dirs (map (lambda (name)
-                                (string-append (assoc-ref inputs name)
-                                               "/include/qt5"))
-                              '("qtdatavis3d"
-                                "qtdeclarative"
-                                "qtlocation"
-                                "qtmultimedia"
-                                "qtquickcontrols"
-                                "qtquickcontrols2"
-                                "qtscript"
-                                "qtscxml"
-                                "qtsensors"
-                                "qtspeech"
-                                "qtsvg"
-                                "qttools-5"
-                                "qtwebchannel"
-                                "qtwebengine"
-                                "qtwebsockets"
-                                "qtx11extras"
-                                "qtxmlpatterns"))))
-               (substitute* "cmake/Macros/PySideModules.cmake"
-                 (("\\$\\{PATH_SEP\\}\\$\\{core_includes\\}" all)
-                  (fold (lambda (dir paths)
-                          (string-append paths "${PATH_SEP}" dir))
-                        all
-                        dirs)))
-               (setenv "CXXFLAGS" (fold (lambda (dir paths)
-                                          (string-append paths " -I" dir))
-                                        ""
-                                        dirs))))))))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'go-to-source-dir
+            (lambda _ (chdir "sources/pyside2") #t))
+          (add-after 'go-to-source-dir 'fix-qt-module-detection
+            (lambda _
+              ;; Activate qt module support even if it not in the same
+              ;; directory as qtbase.
+              (substitute* "../cmake_helpers/helpers.cmake"
+                (("\\(\"\\$\\{found_basepath\\}\" GREATER \"0\"\\)")
+                 "true"))
+              ;; Add include directories for qt modules.
+              (let ((dirs (map (lambda (path)
+                                 (string-append path "/include/qt5"))
+                               (list
+                                #$@(map (lambda (name)
+                                          (this-package-input name))
+                                        '("qtdatavis3d"
+                                          "qtdeclarative"
+                                          "qtlocation"
+                                          "qtmultimedia"
+                                          "qtquickcontrols"
+                                          "qtquickcontrols2"
+                                          "qtscript"
+                                          "qtscxml"
+                                          "qtsensors"
+                                          "qtspeech"
+                                          "qtsvg"
+                                          "qttools"
+                                          "qtwebchannel"
+                                          "qtwebengine"
+                                          "qtwebsockets"
+                                          "qtx11extras"
+                                          "qtxmlpatterns"))))))
+                (substitute* "cmake/Macros/PySideModules.cmake"
+                  (("\\$\\{PATH_SEP\\}\\$\\{core_includes\\}" all)
+                   (fold (lambda (dir paths)
+                           (string-append paths "${PATH_SEP}" dir))
+                         all
+                         dirs)))
+                (setenv "CXXFLAGS" (fold (lambda (dir paths)
+                                           (string-append paths " -I" dir))
+                                         ""
+                                         dirs)))))
+          (add-before 'configure 'set-clang-dir
+            (lambda* (#:key inputs #:allow-other-keys)
+              (let ((clang (assoc-ref inputs "clang-toolchain")))
+                (setenv "CLANG_INSTALL_DIR" clang)
+                #t))))))
     (home-page "https://wiki.qt.io/Qt_for_Python")
     (synopsis
      "The Qt for Python product enables the use of Qt5 APIs in Python applications")
-- 
2.37.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: 0005-gnu-Add-python-pyside-6.patch --]
[-- Type: text/x-patch, Size: 3809 bytes --]

From 73991a4c298292cc1358eb41dc6fb704ff9ca737 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Thu, 25 Aug 2022 12:42:54 +0800
Subject: [PATCH 5/9] gnu: Add python-pyside-6.

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

diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index ce56efd0d8..8612e3b536 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -3955,6 +3955,78 @@ (define-public python-pyside-2
               license:gpl3
               license:gpl2))))
 
+(define-public python-pyside-6
+  (package
+    (inherit python-pyside-2)
+    (name "python-pyside-6")
+    (version (package-version python-shiboken-6))
+    (source (package-source python-shiboken-6))
+    ;; TODO: Add more Qt components if available.
+    (inputs
+     (list qtbase
+           qtdeclarative
+           qtmultimedia
+           qtnetworkauth
+           qtpositioning
+           qtsvg
+           qttools
+           qtwebchannel
+           qtwebengine
+           qtwebsockets))
+    (propagated-inputs
+     (list python-shiboken-6))
+    (native-inputs
+     (list python-wrapper))
+    (arguments
+     (list
+      #:tests? #f
+      #:configure-flags
+      #~(list "-DBUILD_TESTS=FALSE"
+              (string-append "-DPYTHON_EXECUTABLE="
+                             #$(this-package-native-input "python-wrapper")
+                             "/bin/python"))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'go-to-source-dir
+            (lambda _ (chdir "sources/pyside6") #t))
+          (add-after 'go-to-source-dir 'fix-qt-module-detection
+            (lambda _
+              (substitute* "cmake/PySideHelpers.cmake"
+                (("\\(\"\\$\\{found_basepath\\}\" GREATER \"0\"\\)")
+                 "true"))
+              (let ((dirs (map (lambda (path)
+                                 (string-append path "/include/qt6"))
+                               (list
+                                #$@(map (lambda (name)
+                                          (this-package-input name))
+                                        '("qtdeclarative"
+                                          "qtmultimedia"
+                                          "qtnetworkauth"
+                                          "qtpositioning"
+                                          "qtsvg"
+                                          "qttools"
+                                          "qtwebchannel"
+                                          "qtwebengine"
+                                          "qtwebsockets"))))))
+                (substitute* "cmake/Macros/PySideModules.cmake"
+                  (("set\\(shiboken_include_dir_list " all)
+                   (string-append all (string-join dirs ";") " ")))
+                (setenv "CXXFLAGS"
+                        (string-join
+                         (map (lambda (dir)
+                                (string-append "-I" dir))
+                              dirs)
+                         " "))))))))
+    (synopsis
+     "The Qt for Python product enables the use of Qt6 APIs in Python applications")
+    (description
+     "The Qt for Python product enables the use of Qt6 APIs in Python
+applications.  It lets Python developers utilize the full potential of Qt,
+using the PySide6 module.  The PySide6 module provides access to the
+individual Qt modules such as QtCore, QtGui,and so on.  Qt for Python also
+comes with the Shiboken6 CPython binding code generator, which can be used to
+generate Python bindings for your C or C++ code.")))
+
 (define-public python-pyside-2-tools
   (package
     (name "python-pyside-2-tools")
-- 
2.37.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #7: 0006-gnu-python-pyside-2-tools-Use-G-expressions.patch --]
[-- Type: text/x-patch, Size: 1848 bytes --]

From a9203c3b185e23283470984072434f939dcb75cc Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Thu, 25 Aug 2022 13:02:46 +0800
Subject: [PATCH 6/9] gnu: python-pyside-2-tools: Use G-expressions.

* gnu/packages/qt.scm (python-pyside2-tools)[native-inputs]: Use label-less
style.
[arguments]: Use G-expressions.
<#:configure-flags>: Use "this-package-native-input".
---
 gnu/packages/qt.scm | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index 8612e3b536..d9f98c0afb 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -4036,17 +4036,19 @@ (define-public python-pyside-2-tools
     (inputs
      (list python-pyside-2 python-shiboken-2 qtbase-5))
     (native-inputs
-     `(("python" ,python-wrapper)))
+     (list python-wrapper))
     (arguments
-     `(#:tests? #f
-       #:configure-flags
-       (list "-DBUILD_TESTS=off"
-             (string-append "-DPYTHON_EXECUTABLE="
-                            (assoc-ref %build-inputs "python")
-                            "/bin/python"))
-       #:phases (modify-phases %standard-phases
-                  (add-after 'unpack 'go-to-source-dir
-                    (lambda _ (chdir "sources/pyside2-tools") #t)))))
+     (list
+      #:tests? #f
+      #:configure-flags
+      #~(list "-DBUILD_TESTS=off"
+              (string-append "-DPYTHON_EXECUTABLE="
+                             #$(this-package-native-inputs "python-wrapper")
+                             "/bin/python"))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'go-to-source-dir
+            (lambda _ (chdir "sources/pyside2-tools") #t)))))
     (home-page "https://wiki.qt.io/Qt_for_Python")
     (synopsis
      "Contains command line tools for PySide2")
-- 
2.37.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #8: 0007-gnu-python-pyside-2-tools-Fix-synopsis-and-descripti.patch --]
[-- Type: text/x-patch, Size: 1066 bytes --]

From b854a349cc43fde5fdfdf124e3474175d25a0ab1 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Thu, 25 Aug 2022 13:04:45 +0800
Subject: [PATCH 7/9] gnu: python-pyside-2-tools: Fix synopsis and description.

* gnu/packages/qt.scm (python-pyside2-tools)[synopsis]: Use more descriptive
words.
[description]: Ditto.
---
 gnu/packages/qt.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index d9f98c0afb..3d9bb45483 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -4051,9 +4051,9 @@ (define-public python-pyside-2-tools
             (lambda _ (chdir "sources/pyside2-tools") #t)))))
     (home-page "https://wiki.qt.io/Qt_for_Python")
     (synopsis
-     "Contains command line tools for PySide2")
+     "Command line tools for PySide2")
     (description
-     "Contains lupdate, rcc and uic tools for PySide2")
+     "Python-pyside-2-tools contains lupdate, rcc and uic tools for PySide2")
     (license license:gpl2)))
 
 (define-public libqglviewer
-- 
2.37.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #9: 0008-gnu-Add-python-pyside-6-tools.patch --]
[-- Type: text/x-patch, Size: 2635 bytes --]

From 2409816e83098d572d099a10e45129d56ba2a607 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Thu, 25 Aug 2022 13:07:38 +0800
Subject: [PATCH 8/9] gnu: Add python-pyside-6-tools

* gnu/packages/qt.scm (python-pyside-6-tools): New variable.
---
 gnu/packages/qt.scm | 39 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index 3d9bb45483..050bfdb768 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -4043,7 +4043,7 @@ (define-public python-pyside-2-tools
       #:configure-flags
       #~(list "-DBUILD_TESTS=off"
               (string-append "-DPYTHON_EXECUTABLE="
-                             #$(this-package-native-inputs "python-wrapper")
+                             #$(this-package-native-input "python-wrapper")
                              "/bin/python"))
       #:phases
       #~(modify-phases %standard-phases
@@ -4056,6 +4056,43 @@ (define-public python-pyside-2-tools
      "Python-pyside-2-tools contains lupdate, rcc and uic tools for PySide2")
     (license license:gpl2)))
 
+(define-public python-pyside-6-tools
+  (package
+    (inherit python-pyside-2-tools)
+    (name "python-pyside-6-tools")
+    (version (package-version python-shiboken-6))
+    (source (package-source python-shiboken-6))
+    (build-system cmake-build-system)
+    (inputs
+     (list python-pyside-6
+           python-shiboken-6
+           qtbase
+           qtdeclarative
+           qttools))
+    (arguments
+     (substitute-keyword-arguments (package-arguments python-pyside-2-tools)
+       ((#:phases p)
+        #~(modify-phases #$p
+            (replace 'go-to-source-dir
+              (lambda _ (chdir "sources/pyside-tools") #t))
+            (add-after 'go-to-source-dir 'fix-missing-tools
+              (lambda* (#:key inputs #:allow-other-keys)
+                (substitute* "CMakeLists.txt"
+                  (("\\$\\{LIBEXEC_PATH\\}/(.+)\\$" all bin)
+                   (string-append
+                    (search-input-file
+                     inputs (string-append "lib/qt6/libexec/" bin))
+                    "$"))
+                  (("\\$\\{TOOLS_PATH\\}/(.+)\\$" all bin)
+                   (string-append
+                    (search-input-file
+                     inputs (string-append "bin/" bin))
+                    "$")))))))))
+    (synopsis
+     "Command line tools for PySide6")
+    (description
+     "Python-pyside-6-tools contains lupdate, rcc and uic tools for PySide6.")))
+
 (define-public libqglviewer
   (package
     (name "libqglviewer")
-- 
2.37.2


[-- Attachment #10: Type: text/plain, Size: 99 bytes --]

-- 
Retrieve my PGP public key:

  gpg --recv-keys 481F5EEEBA425ADC13247C76A6E672D981B8E744

Zihao

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [bug#57398] Acknowledgement ([PATCH]: Add PySide 6.)
  2022-08-25 10:30   ` [bug#57398] Acknowledgement ([PATCH]: Add PySide 6.) Zhu Zihao
@ 2022-08-30  8:51     ` Zhu Zihao
  2022-09-07 11:27       ` Zhu Zihao
  0 siblings, 1 reply; 5+ messages in thread
From: Zhu Zihao @ 2022-08-30  8:51 UTC (permalink / raw)
  To: 57398

ping.

-- 
Retrieve my PGP public key:

  gpg --recv-keys 481F5EEEBA425ADC13247C76A6E672D981B8E744

Zihao





^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#57398] Acknowledgement ([PATCH]: Add PySide 6.)
  2022-08-30  8:51     ` Zhu Zihao
@ 2022-09-07 11:27       ` Zhu Zihao
  0 siblings, 0 replies; 5+ messages in thread
From: Zhu Zihao @ 2022-09-07 11:27 UTC (permalink / raw)
  To: 57398

[-- Attachment #1: Type: text/plain, Size: 120 bytes --]


ping again.
-- 
Retrieve my PGP public key:

  gpg --recv-keys 481F5EEEBA425ADC13247C76A6E672D981B8E744

Zihao

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 255 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#57398: [PATCH]: Add PySide 6.
  2022-08-25  5:38 [bug#57398] [PATCH]: Add PySide 6 Zhu Zihao
       [not found] ` <handler.57398.B.166140611521962.ack@debbugs.gnu.org>
@ 2022-09-07 17:51 ` Marius Bakke
  1 sibling, 0 replies; 5+ messages in thread
From: Marius Bakke @ 2022-09-07 17:51 UTC (permalink / raw)
  To: Zhu Zihao, 57398-done

[-- Attachment #1: Type: text/plain, Size: 2897 bytes --]

Hi Zhu,

Thanks for these patches, nice work!

I've applied them with a few minor tweaks, see inline.

Zhu Zihao <all_but_last@163.com> skriver:

>>From a4d31ffc721fa3b459e2f168cb4af65147b82248 Mon Sep 17 00:00:00 2001
> From: Zhu Zihao <all_but_last@163.com>
> Date: Wed, 24 Aug 2022 19:25:26 +0800
> Subject: [PATCH 3/9] gnu: python-pyside-2: Use G-expressions.
>
> * gnu/packages/qt.scm (python-pyside-2)[native-inputs]: Use label-less input
> style.
> [arguments]: Use G-expressions.

[...]

>      (native-inputs
> -     `(("cmake" ,cmake-minimal)
> -       ("python" ,python-wrapper)
> -       ("qttools-5" ,qttools-5)
> -       ("which" ,which)))
> +     (list cmake-minimal python-wrapper qttools-5 which))

[...]

> +              ;; Add include directories for qt modules.
> +              (let ((dirs (map (lambda (name)
> +                                 (string-append (assoc-ref inputs name)
> +                                                "/include/qt5"))
> +                               '("qtdatavis3d"
> +                                 "qtdeclarative"
> +                                 "qtlocation"
> +                                 "qtmultimedia"
> +                                 "qtquickcontrols"
> +                                 "qtquickcontrols2"
> +                                 "qtscript"
> +                                 "qtscxml"
> +                                 "qtsensors"
> +                                 "qtspeech"
> +                                 "qtsvg"
> +                                 "qttools-5"

Here qttools-5 would no longer be found, so I changed it.

>>From 801e4315b1ef24fc18cf61169b42443eb221e924 Mon Sep 17 00:00:00 2001
> From: Zhu Zihao <all_but_last@163.com>
> Date: Wed, 24 Aug 2022 22:57:44 +0800
> Subject: [PATCH 5/9] gnu: python-pyside-2: Use "this-package-input" instead of
>  "assoc-ref".
>
> * gnu/packages/qt.scm (python-pyside-2)[arguments]<#:configure-flags>: Use
> "this-package-input"
> <#:phases>: In phase "fix-qt-module-detection", use "this-package-input".

I had to manually apply this patch because I changed the previous one.
While at it, I made one tweak:

> @@ -3880,7 +3880,7 @@ (define-public python-pyside-2
>        #:configure-flags
>        #~(list "-DBUILD_TESTS=FALSE"
>                (string-append "-DPYTHON_EXECUTABLE="
> -                             (assoc-ref %build-inputs "python")
> +                             #$(this-package-native-input "python-wrapper")
>                               "/bin/python"))

I changed this to use (search-input-file ...) instead of
#$(this-package-native-input ...).

And the same in subsequent patches.  The reason is that THIS-PACKAGE has
a runtime cost (meaning the "guix" commands get slower), but
SEARCH-INPUT-FILE is computed at build time.

In short, always use SEARCH-INPUT-FILE when feasible.  :-)

Applied all 9 with these changes!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-09-07 17:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-25  5:38 [bug#57398] [PATCH]: Add PySide 6 Zhu Zihao
     [not found] ` <handler.57398.B.166140611521962.ack@debbugs.gnu.org>
2022-08-25 10:30   ` [bug#57398] Acknowledgement ([PATCH]: Add PySide 6.) Zhu Zihao
2022-08-30  8:51     ` Zhu Zihao
2022-09-07 11:27       ` Zhu Zihao
2022-09-07 17:51 ` bug#57398: [PATCH]: Add PySide 6 Marius Bakke

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).