2018-05-18 09:23:48 +02:00
#
2024-02-26 10:36:05 +01:00
# spec file for package python-wxPython
2018-05-18 09:23:48 +02:00
#
2024-01-18 00:53:20 +01:00
# Copyright (c) 2024 SUSE LLC
2018-05-18 09:23:48 +02:00
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
2019-02-01 20:44:56 +01:00
# Please submit bugfixes or comments via https://bugs.opensuse.org/
2018-06-07 17:13:53 +02:00
#
2018-05-18 09:23:48 +02:00
%define X_display ":98"
2022-08-14 16:40:17 +02:00
%bcond_without test
2020-10-01 01:41:16 +02:00
%bcond_without syswx
2022-08-14 16:40:17 +02:00
# We rebuild the ETG and SIP files for two reasons:
# - Fixing a bug in the ETG time_t typedef (see patch)
# - Compatibility with SIP 6.5.x, for Leap 15.x
%bcond_without rebuild_sip
2018-06-07 17:13:53 +02:00
%if %{with syswx}
%define wx_args --use_syswx --gtk3 -v
%else
%define wx_args --gtk3 -v
%endif
2022-01-04 12:27:04 +01:00
%global flavor @BUILD_FLAVOR@%{nil}
2022-01-05 13:58:20 +01:00
%if "%flavor" == ""
# factory-auto requires the main build_flavor to match the specfile name
2022-01-04 19:01:55 +01:00
%define pprefix python
2022-01-05 13:58:20 +01:00
%define python_module() no-build-without-multibuild-flavor
ExclusiveArch : donotbuild
%else
2022-01-04 12:27:04 +01:00
%define pprefix %flavor
2022-01-05 13:58:20 +01:00
%if 0%{suse_version} >= 1599
# Tumbleweed has a varying number of python3 flavors. The flavor
# selection here and in _multibuild must be kept in sync with the Factory
# prjconf definition for pythons. If a skip is missing, all builds fail.
# Extraneous build_flavors and skips are excluded automatically so future
# additions can be included here early and old flavors can be removed some time
# after the global drop in Factory.
2022-01-04 12:27:04 +01:00
%if "%flavor" != "python39"
%define skip_python39 1
%endif
%if "%flavor" != "python310"
%define skip_python310 1
%endif
2022-08-14 16:40:17 +02:00
%if "%flavor" != "python311"
%define skip_python311 1
%endif
2024-01-18 00:53:20 +01:00
%if "%flavor" != "python312"
%define skip_python312 1
%endif
2022-01-05 13:58:20 +01:00
%else
2024-01-18 11:10:05 +01:00
# SLE/Leap
%if "%flavor" == "python3"
# python3 is the old 3.6
2022-01-05 13:58:20 +01:00
%define pythons python3
%define python3_provides %{nil}
2024-01-18 11:10:05 +01:00
%else
%{?sle15_python_module_pythons}
%if "%flavor" != "%pythons"
# sle15_python_module_pythons defines the flavor, otherwise don't build
%define pythons %{nil}
%endif
2022-01-05 13:58:20 +01:00
%endif
2022-01-04 12:27:04 +01:00
%endif
2024-02-26 10:36:05 +01:00
%if "%{shrink:%pythons}" == ""
2022-01-04 12:27:04 +01:00
ExclusiveArch : donotbuild
2022-01-05 13:58:20 +01:00
%define python_module() %flavor-not-enabled-in-buildset-for-suse-%{?suse_version}
2022-01-04 12:27:04 +01:00
%else
2022-01-05 13:58:20 +01:00
%define python_files() -n %flavor-%{**}
%define python_module() %flavor-%{**}
%define python_exec python%{expand:%%%{flavor}_bin_suffix}
%define python_version %{expand:%%%{flavor}_version}
%define python_sitearch %{expand:%%%{flavor}_sitearch}
%define python_provides %{expand:%%%{flavor}_provides}
2022-01-04 12:27:04 +01:00
%endif
%endif
2022-01-05 13:58:20 +01:00
Name : %{pprefix} -wxPython
2023-09-15 15:12:24 +02:00
Version : 4.2.1
2018-05-18 09:23:48 +02:00
Release : 0
2018-05-18 16:09:54 +02:00
Summary : The " P h o e n i x " variant of the wxWidgets Python bindings
2018-06-07 17:13:53 +02:00
License : GPL-2.0-or-later
2020-10-01 01:41:16 +02:00
Group : System/Libraries
2018-06-07 17:13:53 +02:00
URL : https://github.com/wxWidgets/Phoenix
2023-01-26 21:49:26 +01:00
# repacked https://files.pythonhosted.org/packages/source/w/wxPython/wxPython-%%{version}.tar.gz
Source0 : wxPython-%{version} .tar.gz
2018-06-07 17:13:53 +02:00
Source1 : python-wxPython-rpmlintrc
2023-01-26 21:49:26 +01:00
Source2 : repack
2023-12-26 14:17:53 +01:00
Patch1 : 0001-Update-wxTextCtrl-OSX-overrides-since-they-re-now-do.patch
Patch2 : 0001-Handle-wxGLCanvas-CreateSurface-which-is-only-availa.patch
2023-12-28 11:18:39 +01:00
# PATCH-FIX-UPSTREAM https://github.com/wxWidgets/Phoenix/pull/2497
Patch3 : 0001-Support-building-with-Doxygen-1.9.7.patch
2024-01-18 11:10:05 +01:00
# PATCH-FIX-UPSTREAM https://github.com/wxWidgets/Phoenix/pull/2508
Patch4 : 0001-wxWidgets-Phoenix-integer-division.patch
2020-08-05 00:44:38 +02:00
# PATCH-FIX-OPENSUSE
2023-12-26 14:17:53 +01:00
Patch12 : use_stl_build.patch
2022-08-14 16:40:17 +02:00
# PATCH-FIX-UPSTREAM - https://github.com/wxWidgets/Phoenix/pull/2232
2023-12-26 14:17:53 +01:00
Patch13 : 0003-Make-pip-usage-in-wxget-optional.patch
2022-08-14 16:40:17 +02:00
# PATCH-FIX-OPENSUSE
2023-12-26 14:17:53 +01:00
Patch14 : 0004-Fix-time_t-ETG-typedef-extend-DateTime.FromTimeT-tes.patch
2022-08-14 16:40:17 +02:00
# PATCH-FIX-OPENSUSE - Test fixes/additions:
Patch112 : 0001-Check-HSV-values-in-image-test.patch
2024-01-18 11:10:05 +01:00
# PATCH-FIX-OPENSUSE - Numpy for Python 3.12 is a thing
Patch113 : require-numpy.patch
2024-06-05 17:08:45 +02:00
Patch114 : wxwidgets-3.2.5.patch
2024-06-10 20:21:43 +02:00
# PATCH-FIX-UPSTREAM https://github.com/wxWidgets/Phoenix/pull/2540
Patch115 : drop-py2.patch
2024-01-18 11:10:05 +01:00
# TODO: Replace deprecated setup.py calls in build.py with PEP517 without building wxWidgets into the wheel
2022-01-04 12:27:04 +01:00
BuildRequires : %{python_module base}
2018-05-18 09:23:48 +02:00
BuildRequires : %{python_module devel}
BuildRequires : %{python_module setuptools}
BuildRequires : c++_compiler
BuildRequires : fdupes
2018-06-07 17:13:53 +02:00
BuildRequires : pkgconfig
BuildRequires : python-rpm-macros
2020-08-05 00:44:38 +02:00
%if %{with syswx}
2022-08-14 16:40:17 +02:00
BuildRequires : %{python_module sip6-devel >= 6.5.1}
BuildRequires : waf
BuildRequires : wxGTK3-devel >= 3.2.0
BuildRequires : wxWidgets-3_2-doc-xml >= 3.2.0
2020-08-05 00:44:38 +02:00
%else
BuildRequires : freeglut-devel
BuildRequires : gstreamer-plugins-base-devel
BuildRequires : libjbig-devel
2018-05-18 09:23:48 +02:00
BuildRequires : pkgconfig(gstreamer-1.0)
BuildRequires : pkgconfig(gtk+-3.0)
BuildRequires : pkgconfig(libjpeg)
BuildRequires : pkgconfig(liblzma)
BuildRequires : pkgconfig(libmspack)
BuildRequires : pkgconfig(libnotify)
BuildRequires : pkgconfig(libpng16)
BuildRequires : pkgconfig(libtiff-4)
BuildRequires : pkgconfig(sdl2)
BuildRequires : pkgconfig(sm)
BuildRequires : pkgconfig(webkit2gtk-4.0)
BuildRequires : pkgconfig(x11)
2020-06-23 19:11:54 +02:00
BuildRequires : pkgconfig(xtst)
2020-08-05 00:44:38 +02:00
%endif
2024-01-18 11:10:05 +01:00
Requires : %{pprefix} -Pillow
Requires : %{pprefix} -numpy
2022-01-05 13:58:20 +01:00
Requires(post) : update-alternatives
2024-02-26 10:36:05 +01:00
Requires(postun) : update-alternatives
2022-01-05 13:58:20 +01:00
Conflicts : %{pprefix} -wxWidgets
Provides : %{pprefix} -wxWidgets = %{version}
%if "%{python_provides}" != ""
# for TW primary flavor provider
Conflicts : %{python_provides} -wxWidgets
Provides : %{python_provides} -wxPython = %{version} -%{release}
Provides : %{python_provides} -wxWidgets = %{version}
Obsoletes : %{python_provides} -wxPython < %{version} -%{release}
%endif
2018-05-18 09:23:48 +02:00
%if %{with test}
2024-01-18 11:10:05 +01:00
BuildRequires : %{python_module Pillow}
2020-10-01 01:41:16 +02:00
BuildRequires : %{python_module numpy}
2023-01-05 15:36:58 +01:00
BuildRequires : %{python_module pytest-forked}
2018-05-18 09:23:48 +02:00
BuildRequires : %{python_module pytest-xdist}
2018-06-07 17:13:53 +02:00
BuildRequires : %{python_module pytest}
2022-08-14 16:40:17 +02:00
BuildRequires : Mesa-dri
2020-10-01 01:41:16 +02:00
# Need at least one font installed
BuildRequires : google-opensans-fonts
2022-08-14 16:40:17 +02:00
# BuildRequires: wxWidgets-lang
2020-10-01 01:41:16 +02:00
BuildRequires : xorg-x11-server
BuildRequires : pkgconfig(cppunit)
2018-05-18 09:23:48 +02:00
%endif
%description
2018-05-18 16:09:54 +02:00
Phoenix is a reimplementation of wxPython. Like the " c l a s s i c "
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)
2018-05-18 09:23:48 +02:00
platform specific code.
%package lang
# We cannot use %%lang_package here. Editra translations use noarch incompatible path.
Summary : Languages for package %{name}
2020-10-01 01:41:16 +02:00
Group : System/Libraries
2018-05-18 09:23:48 +02:00
Requires : %{name} = %{version}
2022-01-05 13:58:20 +01:00
Requires : python(abi) = %python_version
2020-03-03 00:59:08 +01:00
Supplements: (bundle-lang-other and %{name} )
2018-06-07 17:13:53 +02:00
Provides : %{name} -lang-all = %{version}
2022-01-05 13:58:20 +01:00
%if "%{python_provides}" != ""
# for TW primary flavor provider
Provides : %{python_provides} -wxPython-lang = %{version} -%{release}
Obsoletes : %{python_provides} -wxPython-lang < %{version} -%{release}
%endif
2018-05-18 09:23:48 +02:00
%description lang
Provides translations to the package %{name} .
%prep
2020-10-01 01:41:16 +02:00
%autosetup -n wxPython-%{version} -p1
2023-01-24 14:51:13 +01:00
# https://github.com/wxWidgets/Phoenix/issues/2105
# https://bugzilla.suse.com/show_bug.cgi?id=670523
find -iname *.dll | grep . && \
{ echo " p l e a s e r u n r e p a c k s c r i p t ( g h # 2 1 0 5 ) " ; exit 1; }
2022-08-14 16:40:17 +02:00
# Lower minimum Python version
sed -i -e '/check_python_version/ s@3,7,0@3,6,0@' wscript
# Reuse locale from wxWidgets package
%if %{with syswx}
rm -Rf wx/locale
%endif
2022-01-04 12:27:04 +01:00
2018-05-18 09:23:48 +02:00
sed -i -e '/^#!\//, 1d' wx/py/*.py
sed -i -e '/^#!\//, 1d' wx/tools/*.py
sed -i -e '/^#!\//, 1d' wx/py/tests/*.py
2022-01-04 12:27:04 +01:00
echo " # e m p t y m o d u l e " >> wx/lib/pubsub/core/itopicdefnprovider.py
2018-05-18 09:23:48 +02:00
%build
export CFLAGS=" %{optflags} "
2022-08-14 16:40:17 +02:00
%if %{with rebuild_sip}
# Save LICENSE* files from bundled siplib
mv sip/siplib{,_old}
2018-05-18 09:23:48 +02:00
export DOXYGEN=%{_bindir} /doxygen
2022-08-14 16:40:17 +02:00
export SIP=%{_bindir} /sip
export WAF=%{_bindir} /waf
mkdir -p /tmp/wxxml/docs/doxygen/out/
rm -f /tmp/wxxml/docs/doxygen/out/xml
cp ext/wxWidgets/docs/*.txt /tmp/wxxml/docs/
ln -sf %{_docdir} /wxWidgets*doc-xml /tmp/wxxml/docs/doxygen/out/xml
export WXWIN=/tmp/wxxml/
%python_exec build.py touch %{wx_args}
%python_exec build.py etg --nodoc %{wx_args}
%python_exec build.py sip %{wx_args}
cp sip/siplib_old/LICENSE* sip/siplib/
if [ ! -e sip/siplib/sip_array.c ]; then
cp sip/siplib/{,sip_}array.c
cp sip/siplib/{,sip_}array.h
fi
%endif
2022-01-05 13:58:20 +01:00
%python_exec build.py build %{wx_args}
2018-05-18 09:23:48 +02:00
%install
2022-01-05 13:58:20 +01:00
%python_exec build.py install %{wx_args} --destdir=%{buildroot} --extra_setup=" - O 1 - - f o r c e "
2018-05-18 09:23:48 +02:00
2022-01-05 13:58:20 +01:00
%fdupes %{buildroot} %{_libdir}
2018-05-18 09:23:48 +02:00
%python_clone -a %{buildroot} %{_bindir} /helpviewer
%python_clone -a %{buildroot} %{_bindir} /img2png
%python_clone -a %{buildroot} %{_bindir} /img2py
%python_clone -a %{buildroot} %{_bindir} /img2xpm
%python_clone -a %{buildroot} %{_bindir} /pycrust
%python_clone -a %{buildroot} %{_bindir} /pyshell
%python_clone -a %{buildroot} %{_bindir} /pyslices
%python_clone -a %{buildroot} %{_bindir} /pyslicesshell
%python_clone -a %{buildroot} %{_bindir} /pywxrc
%python_clone -a %{buildroot} %{_bindir} /wxdemo
%python_clone -a %{buildroot} %{_bindir} /wxdocs
%python_clone -a %{buildroot} %{_bindir} /wxget
2022-08-14 16:40:17 +02:00
%if %{without syswx}
2022-01-04 12:27:04 +01:00
%find_lang wxstd
2022-08-14 16:40:17 +02:00
%endif
2022-01-04 12:27:04 +01:00
2018-05-18 09:23:48 +02:00
%check
2020-10-01 01:41:16 +02:00
%if %{with test}
2018-05-18 09:23:48 +02:00
#############################################
### Launch a virtual framebuffer X server ###
#############################################
export DISPLAY=%{X_display}
Xvfb %{X_display} >& Xvfb.log &
trap " k i l l $ ! | | t r u e " EXIT
2020-10-01 01:41:16 +02:00
sleep 5
2018-05-18 09:23:48 +02:00
2020-10-01 01:41:16 +02:00
# Make sure "import wx" does not confuse the wx dir with the module
2018-05-18 09:23:48 +02:00
mv wx wx_temp
2020-10-01 01:41:16 +02:00
2023-01-05 15:36:58 +01:00
# pytest --forked from python-pytest-forked:
2020-10-01 01:41:16 +02:00
# Run each test as a separate process, otherwise multiple app
2023-01-05 15:36:58 +01:00
# instances will corrupt each others static data.
#
2020-10-01 01:41:16 +02:00
# Run UiAction tests one by one
%pytest_arch --forked -n 1 -k 'test_uiaction or test_mousemanager' unittests/
# Skip Auto ID management test (only enabled on Windows)
# Skip Frame restore (requires a window manager)
2022-08-14 16:40:17 +02:00
# Skip Locale.GetString, we do not ship translations for wxWidgets-3_2
# Skip wx.lib.pubsub, fails due to PYTHONDONTWRITEBYTECODE, also deprecated for pypubsub
2020-10-01 01:41:16 +02:00
# Skip UiAction tests (already done)
2022-08-14 16:40:17 +02:00
%{pytest_arch --forked -n 4 -k \
'(not test_newIdRef03) and (not test_uiaction) and (not test_mousemanager) and (not test_frameRestore) and (not test_intlGetString) and (not lib_pubsub_Except) and (not test_xrc7)' \
unittests/
}
2020-10-01 01:41:16 +02:00
2018-05-18 09:23:48 +02:00
mv wx_temp wx
%endif
%post
2022-01-05 13:58:20 +01:00
%python_install_alternative pywxrc helpviewer img2png img2py img2xpm pycrust pyshell pyslices pyslicesshell wxdemo wxdocs wxget
2018-05-18 09:23:48 +02:00
%postun
2022-01-05 13:58:20 +01:00
%python_uninstall_alternative pywxrc
2018-05-18 09:23:48 +02:00
2022-01-05 13:58:20 +01:00
%files
2020-10-01 01:41:16 +02:00
%license LICENSE.txt license/*.txt
%doc CHANGES.rst README.rst TODO.rst
2018-05-18 09:23:48 +02:00
%python_alternative %{_bindir} /helpviewer
%python_alternative %{_bindir} /img2png
%python_alternative %{_bindir} /img2py
%python_alternative %{_bindir} /img2xpm
%python_alternative %{_bindir} /pycrust
%python_alternative %{_bindir} /pyshell
%python_alternative %{_bindir} /pyslices
%python_alternative %{_bindir} /pyslicesshell
%python_alternative %{_bindir} /pywxrc
%python_alternative %{_bindir} /wxdemo
%python_alternative %{_bindir} /wxdocs
%python_alternative %{_bindir} /wxget
2024-01-18 11:10:05 +01:00
%{python_sitearch} /wxPython-%{version} -py*.egg-info
2018-05-18 09:23:48 +02:00
%{python_sitearch} /wx/
2022-08-14 16:40:17 +02:00
%if %{without syswx}
2018-05-18 09:23:48 +02:00
%exclude %{python_sitearch} /wx/locale/
2022-08-14 16:40:17 +02:00
%endif
2018-05-18 09:23:48 +02:00
2022-08-14 16:40:17 +02:00
%if %{without syswx}
2022-01-05 13:58:20 +01:00
%files lang -f wxstd.lang
%dir %{python_sitearch} /wx/locale/
%dir %{python_sitearch} /wx/locale/*
%dir %{python_sitearch} /wx/locale/*/LC_MESSAGES
2022-08-14 16:40:17 +02:00
%endif
2018-05-18 09:23:48 +02:00
%changelog