~ruther/guix-local

08c613ecb7fa1f1cfb741f75c7f9fad743dfb4ba — Nicolas Graves via Guix-patches via 1 year, 3 months ago 239c9d8
gnu: python-wxpython: Update to 4.2.2.

* gnu/packages/wxwidgets.scm (python-wxpython): Update to 4.2.2.
[source]: Remove uneeded patch.
[arguments]{phases}: Add phase 'patch-avoid-circular-import. Add phase
'add-missing.so.
{modules}: Add necessary modules for new phases.
[native-inputs]: Add python-setuptools, python-wheel.
* gnu/packages/patches/python-wxwidgets-type-errors.patch: Remove
patch.
* gnu/local.mk: Unregister patch.

Signed-off-by: Steve George <steve@futurile.net>
3 files changed, 40 insertions(+), 54 deletions(-)

M gnu/local.mk
D gnu/packages/patches/python-wxwidgets-type-errors.patch
M gnu/packages/wxwidgets.scm
M gnu/local.mk => gnu/local.mk +0 -1
@@ 2024,7 2024,6 @@ dist_patch_DATA =						\
  %D%/packages/patches/python-sgmllib3k-assertions.patch	\
  %D%/packages/patches/python-sphobjinv-defer-ssl-import.patch	\
  %D%/packages/patches/python-sphinx-prompt-docutils-0.19.patch	\
  %D%/packages/patches/python-wxwidgets-type-errors.patch	\
  %D%/packages/patches/qcodeeditor-qt6.patch			\
  %D%/packages/patches/qtdeclarative-5-disable-qmlcache.patch	\
  %D%/packages/patches/qtdeclarative-disable-qmlcache.patch	\

D gnu/packages/patches/python-wxwidgets-type-errors.patch => gnu/packages/patches/python-wxwidgets-type-errors.patch +0 -42
@@ 1,42 0,0 @@
Merged upstream but not yet released (see:
https://github.com/wxWidgets/Phoenix/pull/2387/commits/5d9f7aa185cd18da3e93ae1d0033fb9172d7a714).

From 5d9f7aa185cd18da3e93ae1d0033fb9172d7a714 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Mon, 1 May 2023 13:53:55 -0400
Subject: [PATCH] agw: Fix TypeError caused by floats with Python 3.10
 extensions.

This fixes the following error:

   File "/lib/python3.10/site-packages/wx/lib/agw/pygauge.py", line 380, in OnPaint
       dc.DrawText(drawString, textXPos, textYPos)
   TypeError: DC.DrawText(): arguments did not match any overloaded call:
     overload 1: argument 2 has unexpected type 'float'
     overload 2: argument 2 has unexpected type 'float'
   TimeLeft: 3.0

Visible when using Python 3.10 or newer.
---
 wx/lib/agw/pygauge.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/wx/lib/agw/pygauge.py b/wx/lib/agw/pygauge.py
index b8654436a..da42e6f61 100644
--- a/wx/lib/agw/pygauge.py
+++ b/wx/lib/agw/pygauge.py
@@ -367,12 +367,12 @@ def OnPaint(self, event):
             drawString = self._drawIndicatorText_formatString.format(drawValue)
             rect = self.GetClientRect()
             (textWidth, textHeight, descent, extraLeading) = dc.GetFullTextExtent(drawString)
-            textYPos = (rect.height-textHeight)/2
+            textYPos = (rect.height-textHeight)//2
 
             if textHeight > rect.height:
                 textYPos = 0-descent+extraLeading
 
-            textXPos = (rect.width-textWidth)/2
+            textXPos = (rect.width-textWidth)//2
 
             if textWidth>rect.width:
                 textXPos = 0

M gnu/packages/wxwidgets.scm => gnu/packages/wxwidgets.scm +40 -11
@@ 13,6 13,7 @@
;;; Copyright © 2023 Malte Frank Gerdes <malte.f.gerdes@gmail.com>
;;; Copyright © 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2025 Ekaitz Zarraga <ekaitz@elenq.tech>
;;; Copyright © 2025 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;


@@ 37,6 38,7 @@
  #:use-module ((guix licenses) #:prefix l:)
  #:use-module (guix build-system glib-or-gtk)
  #:use-module (guix build-system perl)
  #:use-module (guix build-system pyproject)
  #:use-module (guix build-system python)
  #:use-module (guix utils)
  #:use-module (gnu packages)


@@ 57,7 59,9 @@
  #:use-module (gnu packages photo)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages python)
  #:use-module (gnu packages python-build)
  #:use-module (gnu packages python-xyz)
  #:use-module (gnu packages qt)
  #:use-module (gnu packages sdl)
  #:use-module (gnu packages video)
  #:use-module (gnu packages web)


@@ 318,26 322,38 @@ and many other languages.")
(define-public python-wxpython
  (package
    (name "python-wxpython")
    (version "4.2.0")
    (version "4.2.2")
    (source
     (origin
       (method url-fetch)
       (uri (pypi-uri "wxPython" version))
       (sha256
        (base32
         "1iw6xp76b3fmdqwbqmsx9i1razzpfki5z1hq6l8mszlxa32fng36"))
        (base32 "1fp2717a96hd5pdai6hlzc4pngdazxas55apjv2w5zb71xjv1g2x"))
       (modules '((guix build utils)))
       (snippet
        '(begin
           ;; Remove bundled wxwidgets
           (delete-file-recursively "ext/wxWidgets")))
       (patches (search-patches "python-wxwidgets-type-errors.patch"))))
    (build-system python-build-system)
       (snippet #~(begin
                    ;; Remove bundled wxWidgets
                    (delete-file-recursively "ext/wxWidgets")))))
    (build-system pyproject-build-system)
    (outputs '("out" "debug"))
    (arguments
     (list
      #:modules '((guix build pyproject-build-system)
                  (guix build utils)
                  (ice-9 ftw)
                  (ice-9 match)
                  (srfi srfi-26))
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'unpack 'patch-avoid-circular-import
            (lambda _
              (substitute* "wx/__init__.py"
                (("^import wx\\.__version__.*$") "\
try:
    import wx.__version__
except ImportError:
    pass\n")
                (("^__version__ = .*")
                 (format #f "__version__ = ~s~%" #$version)))))
          (add-before 'build 'configure
            (lambda* (#:key inputs #:allow-other-keys)
              ;; Configure the build options provided to the 'build.py' build


@@ 357,11 373,24 @@ and many other languages.")
                 (string-append "#" all)))
              ;; The build script tries to write to demo/version.py. So, we set
              ;; correct write permissions.
              (chmod "demo/version.py" #o644))))))
              (chmod "demo/version.py" #o644)))
          (add-before 'check 'add-missing-.so
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let ((site (site-packages inputs outputs)))
                (with-directory-excursion (string-append site "/wx")
                  (for-each
                   (match-lambda
                     ("siplib"
                      (rename-file "siplib" "siplib.so"))
                     ((? (cut string-prefix? "_" <>) file)
                      (unless (string-prefix? "__" file)
                        (rename-file file (string-append file ".so"))))
                     (_ #t))
                   (scandir ".")))))))))
    (inputs
     (list gtk+ wxwidgets))
    (native-inputs
     (list pkg-config python-waf))
     (list pkg-config python-setuptools python-waf python-wheel))
    (propagated-inputs
     (list python-attrdict3 python-numpy python-pillow python-six))
    (home-page "https://wxpython.org/")