From 39ba8a10971f15264966823e8696d63c2995df86 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Mon, 1 May 2023 13:59:08 -0400 Subject: gnu: python-wxpython: Apply patch to fix TypeError exceptions. This is caused by Python 3.10's new behavior of native extension now rejecting float values as input when the expected type is an integer. * gnu/packages/patches/python-wxwidgets-type-errors.patch: New patch. * gnu/local.mk (dist_patch_DATA): Register it. * gnu/packages/wxwidgets.scm (python-wxpython) [source]: Apply it. Delete trailing #t. [arguments]: Delete trailing #t. --- gnu/local.mk | 1 + .../patches/python-wxwidgets-type-errors.patch | 42 ++++++++++++++++++++++ gnu/packages/wxwidgets.scm | 7 ++-- 3 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 gnu/packages/patches/python-wxwidgets-type-errors.patch (limited to 'gnu') diff --git a/gnu/local.mk b/gnu/local.mk index 4976b5c740..ebe5893373 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1687,6 +1687,7 @@ dist_patch_DATA = \ %D%/packages/patches/python-telingo-fix-comparison.patch \ %D%/packages/patches/python-typeguard-python3.10.patch \ %D%/packages/patches/python-w3lib-fix-test-failure.patch \ + %D%/packages/patches/python-wxwidgets-type-errors.patch \ %D%/packages/patches/scribus-1.5.8-poppler-22.03.0.patch \ %D%/packages/patches/scribus-1.5.8-poppler-22.04.0.patch \ %D%/packages/patches/scribus-1.5.8-poppler-22.09.0.patch \ diff --git a/gnu/packages/patches/python-wxwidgets-type-errors.patch b/gnu/packages/patches/python-wxwidgets-type-errors.patch new file mode 100644 index 0000000000..53e48c0886 --- /dev/null +++ b/gnu/packages/patches/python-wxwidgets-type-errors.patch @@ -0,0 +1,42 @@ +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 +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 diff --git a/gnu/packages/wxwidgets.scm b/gnu/packages/wxwidgets.scm index b226aa4e83..5415f47f55 100644 --- a/gnu/packages/wxwidgets.scm +++ b/gnu/packages/wxwidgets.scm @@ -276,8 +276,8 @@ and many other languages.") (snippet '(begin ;; Remove bundled wxwidgets - (delete-file-recursively "ext/wxWidgets") - #t)))) + (delete-file-recursively "ext/wxWidgets"))) + (patches (search-patches "python-wxwidgets-type-errors.patch")))) (build-system python-build-system) (arguments `(#:phases @@ -300,8 +300,7 @@ and many other languages.") (chmod "demo/version.py" #o644) ;; Build only the python bindings, not wxwidgets also. (substitute* "setup.py" - (("'build']") "'build_py', '--use_syswx']")) - #t))))) + (("'build']") "'build_py', '--use_syswx']"))))))) (inputs (list gtk+ wxwidgets)) (native-inputs -- cgit v1.2.3