1
0

Accepting request 943732 from home:mcepl:branches:X11:wxWidgets

- Add additional patches fixing the situation with Python 3.10
  compatibility:
  - 2039-bunch-py310-fixes.patch (from gh#wxWidgets/Phoenix#2039)
  - additional-310-fixes.patch (from various commits on master)
- Split out the TW python3 flavors into multibuild using the
  python_subpackage_only mechanism: Multiple python3 flavors
  sequentially require too much space and time in one build.

OBS-URL: https://build.opensuse.org/request/show/943732
OBS-URL: https://build.opensuse.org/package/show/X11:wxWidgets/python-wxPython?expand=0&rev=29
This commit is contained in:
Jan Engelhardt 2022-01-04 11:27:04 +00:00 committed by Git OBS Bridge
parent c038434ed6
commit ff0538714f
7 changed files with 3211 additions and 21 deletions

2981
2039-bunch-py310-fixes.patch Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
<constraints>
<hardware>
<disk>
<size unit="G">15</size>
<size unit="G">8</size>
</disk>
</hardware>
</constraints>

6
_multibuild Normal file
View File

@ -0,0 +1,6 @@
<multibuild>
<package>python36</package>
<package>python38</package>
<package>python39</package>
<package>python310</package>
</multibuild>

View File

@ -0,0 +1,83 @@
---
docker/build/ubuntu-18.04/Dockerfile | 4 +++-
docker/build/ubuntu-20.04/Dockerfile | 2 +-
wx/lib/agw/flatnotebook.py | 14 +++++++-------
wx/svg/__init__.py | 4 ++--
4 files changed, 13 insertions(+), 11 deletions(-)
--- a/docker/build/ubuntu-18.04/Dockerfile
+++ b/docker/build/ubuntu-18.04/Dockerfile
@@ -53,6 +53,7 @@ RUN \
apt-get install -y python3.7 python3.7-dev libpython3.7-dev python3.7-venv; \
apt-get install -y python3.8 python3.8-dev libpython3.8-dev python3.8-venv; \
apt-get install -y python3.9 python3.9-dev libpython3.9-dev python3.9-venv; \
+ apt-get install -y python3.10 python3.10-dev libpython3.10-dev python3.10-venv; \
apt-get clean;
# Add files from host into the container
@@ -72,7 +73,8 @@ RUN \
python3.6 -m venv venvs/Py36; \
python3.7 -m venv venvs/Py37; \
python3.8 -m venv venvs/Py38; \
- python3.9 -m venv venvs/Py39;
+ python3.9 -m venv venvs/Py39; \
+ python3.10 -m venv venvs/Py310;
# Define default command
CMD ["/bin/bash", "-l"]
--- a/docker/build/ubuntu-20.04/Dockerfile
+++ b/docker/build/ubuntu-20.04/Dockerfile
@@ -3,7 +3,7 @@ FROM ubuntu:20.04
# Set environment variables
ENV DIST_NAME=ubuntu-20.04
-ENV USE_DEADSNAKES=no
+ENV USE_DEADSNAKES=yes
ENV USER=wxpy
ENV HOME=/home/$USER
ENV PYTHONUNBUFFERED=1
--- a/wx/lib/agw/flatnotebook.py
+++ b/wx/lib/agw/flatnotebook.py
@@ -925,14 +925,14 @@ def DrawButton(dc, rect, focus, upperTab
if focus:
if upperTabs:
- leftPt = wx.Point(rect.x, rect.y + (rect.height / 10)*8)
- rightPt = wx.Point(rect.x + rect.width - 2, rect.y + (rect.height / 10)*8)
+ leftPt = wx.Point(rect.x, int(rect.y + (rect.height / 10)*8))
+ rightPt = wx.Point(rect.x + rect.width - 2, int(rect.y + (rect.height / 10)*8))
else:
- leftPt = wx.Point(rect.x, rect.y + (rect.height / 10)*5)
- rightPt = wx.Point(rect.x + rect.width - 2, rect.y + (rect.height / 10)*5)
+ leftPt = wx.Point(rect.x, int(rect.y + (rect.height / 10)*5))
+ rightPt = wx.Point(rect.x + rect.width - 2, int(rect.y + (rect.height / 10)*5))
else:
- leftPt = wx.Point(rect.x, rect.y + (rect.height / 2))
- rightPt = wx.Point(rect.x + rect.width - 2, rect.y + (rect.height / 2))
+ leftPt = wx.Point(rect.x, int(rect.y + (rect.height / 2)))
+ rightPt = wx.Point(rect.x + rect.width - 2, int(rect.y + (rect.height / 2)))
# Define the top region
top = wx.Rect(rect.GetTopLeft(), rightPt)
@@ -2765,7 +2765,7 @@ class FNBRendererFirefox2(FNBRenderer):
if pageTextColour is not None:
dc.SetTextForeground(pageTextColour)
- dc.DrawText(pc.GetPageText(tabIdx), posx + textOffset, imageYCoord)
+ dc.DrawText(pc.GetPageText(tabIdx), int(posx + textOffset), imageYCoord)
# draw 'x' on tab (if enabled)
if pc.HasAGWFlag(FNB_X_ON_TAB) and tabIdx == pc.GetSelection():
--- a/wx/svg/__init__.py
+++ b/wx/svg/__init__.py
@@ -132,8 +132,8 @@ class SVGimage(SVGimageBase):
"""
size = wx.Size(*size)
if window:
- size.width *= window.GetContentScaleFactor()
- size.height *= window.GetContentScaleFactor()
+ size.width = int(size.width * window.GetContentScaleFactor())
+ size.height = int(size.height * window.GetContentScaleFactor())
# We can only have one overall scale factor for both dimensions with
# this rasterization method, so chose either the minimum of width or

View File

@ -1 +1,3 @@
addFilter("devel-file-in-non-devel-package")
# the multibuild flavors need differently named source packages
addFilter("invalid-spec-name")

View File

@ -1,3 +1,18 @@
-------------------------------------------------------------------
Tue Jan 4 10:18:08 UTC 2022 - Matej Cepl <mcepl@suse.com>
- Add additional patches fixing the situation with Python 3.10
compatibility:
- 2039-bunch-py310-fixes.patch (from gh#wxWidgets/Phoenix#2039)
- additional-310-fixes.patch (from various commits on master)
-------------------------------------------------------------------
Wed Dec 29 10:23:20 UTC 2021 - Ben Greiner <code@bnavigator.de>
- Split out the TW python3 flavors into multibuild using the
python_subpackage_only mechanism: Multiple python3 flavors
sequentially require too much space and time in one build.
-------------------------------------------------------------------
Sat Jun 12 16:32:57 UTC 2021 - Antoine Belvire <antoine.belvire@opensuse.org>

View File

@ -1,7 +1,7 @@
#
# spec file for package python-wxPython
# spec file
#
# Copyright (c) 2021 SUSE LLC
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -16,9 +16,6 @@
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
%define oldpython python
%define X_display ":98"
%bcond_with test
%bcond_without syswx
@ -27,11 +24,53 @@
%else
%define wx_args --gtk3 -v
%endif
%if %{with test}
%global flavor @BUILD_FLAVOR@%{nil}
%if 0%{suse_version} >= 1550
# Tumbleweed has a varying number of python3 flavors. Ideally, the flavor
# selection here and in _multibuild is in sync with the Factory prjconf
# definition for pythons, but if it is not, we build missing flavors in -other
# and do not build flavors which are not yet or not anymore in the buildset.
%define pprefix %flavor
%define psuffix -mb
%if "%flavor" != "python36" || %{with test}
# No numpy for Python 3.6
%define skip_python36 1
%endif
Name: python-wxPython
%if "%flavor" != "python38"
%define skip_python38 1
%endif
%if "%flavor" != "python39"
%define skip_python39 1
%endif
%if "%flavor" != "python310"
%define skip_python310 1
%endif
%if "%flavor" == ""
%define pprefix python
%define psuffix -other
%endif
# The obs server-side interpreter cannot use lua or rpm shrink
%if "%pythons" == "" || "%pythons" == " " || "%pythons" == " " || "%pythons" == " "
ExclusiveArch: donotbuild
%endif
%else
# The SLE/Leap python3 package is built without subpackage rewriting in the main flavor
%if "%flavor" == ""
%define pprefix python3
%define psuffix %{nil}
%define pythons python3
%define python_files() -n %{pprefix}-%{**}
%define python_module() python3-%{**}
%define python_version %python3_version
%define python_sitearch %python3_sitearch
%else
ExclusiveArch: donotbuild
%endif
%endif
%define plainpython python
Name: %{pprefix}-wxPython%{psuffix}
Version: 4.1.1
Release: 0
Summary: The "Phoenix" variant of the wxWidgets Python bindings
@ -46,6 +85,13 @@ Patch0: fix_no_return_in_nonvoid.patch
Patch1: use_stl_build.patch
# PATCH-FIX-UPSTREAM wxPython-4.1.1-fix-overrides.patch -- Fix build with wxWidgets 3.1.5 (gh#wxWidgets/Phoenix#1909)
Patch2: wxPython-4.1.1-fix-overrides.patch
# PATCH-FIX-UPSTREAM 2039-bunch-py310-fixes.patch gh#wxWidgets/Phoenix#2039 mcepl@suse.com
# Fix a bunch of Python 3.10 issues with pure-Python classes and demos
Patch3: 2039-bunch-py310-fixes.patch
# PATCH-FIX-UPSTREAM additional-310-fixes.patch bsc#[0-9]+ mcepl@suse.com
# collection of patches:
Patch4: additional-310-fixes.patch
BuildRequires: %{python_module base}
BuildRequires: %{python_module devel}
BuildRequires: %{python_module requests}
BuildRequires: %{python_module setuptools}
@ -73,11 +119,6 @@ BuildRequires: pkgconfig(webkit2gtk-4.0)
BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(xtst)
%endif
Requires: python-six
Requires(post): update-alternatives
Requires(postun):update-alternatives
Conflicts: python-wxWidgets
Provides: python-wxWidgets = %{version}
%if %{with test}
BuildRequires: %{python_module numpy}
BuildRequires: %{python_module pytest-xdist}
@ -89,11 +130,16 @@ BuildRequires: wxWidgets-lang
BuildRequires: xorg-x11-server
BuildRequires: pkgconfig(cppunit)
%endif
%ifpython2
Conflicts: %{oldpython}-wxWidgets
Provides: %{oldpython}-wxWidgets = %{version}
%endif
%if 0%{suse_version} >= 1550
%define python_subpackage_only 1
%python_subpackages
%else
Requires: %{pprefix}-six
Requires(post): update-alternatives
Requires(postun):update-alternatives
Conflicts: %{pprefix}-wxWidgets
Provides: %{pprefix}-wxWidgets = %{version}
%endif
%description
Phoenix is a reimplementation of wxPython. Like the "classic"
@ -108,18 +154,49 @@ platform specific code.
Summary: Languages for package %{name}
Group: System/Libraries
Requires: %{name} = %{version}
Requires: python-base
Requires: %{plainpython}(abi) = %python_version
Supplements: (bundle-lang-other and %{name})
Provides: %{name}-lang-all = %{version}
%description lang
Provides translations to the package %{name}.
%package -n python-wxPython%{?nosub}
# extra definition for %%python_subpackage_only mechanism, keep in sync with main definitions.
Summary: The "Phoenix" variant of the wxWidgets Python bindings
Requires: python-six
Requires(post): update-alternatives
Requires(postun):update-alternatives
Conflicts: python-wxWidgets
Provides: python-wxWidgets = %{version}
%description -n python-wxPython
Phoenix is a reimplementation of wxPython. Like the "classic"
wxPython, Phoenix wraps the wxWidgets C++ toolkit and provides access
to the user interface portions of the wxWidgets API, enabling Python
applications to have a GUI on Windows, macOS or Unix-like systems,
with a native look and feel and requiring very little (if any)
platform specific code.
%package -n python-wxPython-lang
# We cannot use %%lang_package here. Editra translations use noarch incompatible path.
Summary: Languages for package %{pprefix}-wxPython
Group: System/Libraries
Requires: python-wxPython = %{version}
Requires: %{plainpython}(abi) = %python_version
Supplements: (bundle-lang-other and python-wxPython)
Provides: python-wxPython-lang-all = %{version}
%description -n python-wxPython-lang
Provides translations to the package %pprefix-wxPython.
%prep
%autosetup -n wxPython-%{version} -p1
sed -i -e '/^#!\//, 1d' wx/py/*.py
sed -i -e '/^#!\//, 1d' wx/tools/*.py
sed -i -e '/^#!\//, 1d' wx/py/tests/*.py
echo "# empty module" >> wx/lib/pubsub/core/itopicdefnprovider.py
%build
export CFLAGS="%{optflags}"
@ -147,6 +224,21 @@ export DOXYGEN=%{_bindir}/doxygen
%python_clone -a %{buildroot}%{_bindir}/wxdocs
%python_clone -a %{buildroot}%{_bindir}/wxget
# Note: find_lang only works for one python flavor per multibuild,
# cannot use python_find_lang in python_subpackage_only mode.
%find_lang wxstd
%{python_expand #
echo "%%dir %{$python_sitearch}/wx/locale/
%%dir %{$python_sitearch}/wx/locale/*
%%dir %{$python_sitearch}/wx/locale/*/LC_MESSAGES" >> wxstd.lang
}
%if "%psuffix" == "-other"
if [ $(echo %pythons | wc -w) -gt 1 ]; then
# could not collect for only one flavor, package locale files unmarked
echo "" > wxstd.lang
fi
%endif
%check
%if %{with test}
#############################################
@ -172,13 +264,22 @@ mv wx wx_temp
mv wx_temp wx
%endif
%if 0%{?python_subpackage_only}
%post -n python-wxPython
%{python_install_alternative pywxrc helpviewer img2png img2py img2xpm pycrust pyshell pyslices pyslicesshell wxdemo wxdocs wxget}
%postun -n python-wxPython
%{python_uninstall_alternative pywxrc}
%else
%post
%{python_install_alternative pywxrc helpviewer img2png img2py img2xpm pycrust pyshell pyslices pyslicesshell wxdemo wxdocs wxget}
%postun
%{python_uninstall_alternative pywxrc helpviewer img2png img2py img2xpm pycrust pyshell pyslices pyslicesshell wxdemo wxdocs wxget}
%{python_uninstall_alternative pywxrc}
%endif
%files %{python_files}
%files %{python_files wxPython}
%license LICENSE.txt license/*.txt
%doc CHANGES.rst README.rst TODO.rst
%python_alternative %{_bindir}/helpviewer
@ -197,7 +298,9 @@ mv wx_temp wx
%{python_sitearch}/wx/
%exclude %{python_sitearch}/wx/locale/
%files %{python_files lang}
%files %{python_files wxPython-lang} -f wxstd.lang
%if "%psuffix" == "-other"
%{python_sitearch}/wx/locale/
%endif
%changelog