2018-05-18 09:23:48 +02:00
#
2022-01-04 12:27:04 +01:00
# spec file
2018-05-18 09:23:48 +02:00
#
2022-01-04 12:27:04 +01:00
# Copyright (c) 2022 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" != "python38"
%define skip_python38 1
%endif
%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
2022-01-05 13:58:20 +01:00
%else
# SLE/Leap: python3 only
%if "%flavor" != "python3"
%define pythons %{nil}
%else
%define pythons python3
%define python3_provides %{nil}
%endif
2022-01-04 12:27:04 +01:00
%endif
# The obs server-side interpreter cannot use lua or rpm shrink
2022-01-05 13:58:20 +01:00
%if "%pythons" == "" || "%pythons" == " " || "%pythons" == " " || "%pythons" == " " || "%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
2022-08-14 16:40:17 +02:00
Version : 4.2.0
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
2018-05-18 09:23:48 +02:00
Source : https://files.pythonhosted.org/packages/source/w/wxPython/wxPython-%{version} .tar.gz
2018-06-07 17:13:53 +02:00
Source1 : python-wxPython-rpmlintrc
2020-08-05 00:44:38 +02:00
# PATCH-FIX-OPENSUSE
Patch1 : use_stl_build.patch
2022-08-14 16:40:17 +02:00
# PATCH-FIX-UPSTREAM
Patch2 : 0001-Only-import-attrdict-where-needed.patch
# PATCH-FIX-UPSTREAM - https://github.com/wxWidgets/Phoenix/pull/2232
Patch4 : 0003-Make-pip-usage-in-wxget-optional.patch
# PATCH-FIX-OPENSUSE
Patch5 : 0004-Fix-time_t-ETG-typedef-extend-DateTime.FromTimeT-tes.patch
# PATCH-FIX-OPENSUSE - Test fixes/additions:
Patch112 : 0001-Check-HSV-values-in-image-test.patch
# PATCH-FIX-UPSTREAM - https://github.com/wxWidgets/Phoenix/pull/2233
Patch113 : 0001-Fix-overflow-check-for-wxUIntPtr-type.patch
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 requests}
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
2022-01-05 13:58:20 +01:00
Requires : %{pprefix} -six
Requires(post) : update-alternatives
Requires(postun) : update-alternatives
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}
2020-10-01 01:41:16 +02:00
BuildRequires : %{python_module numpy}
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}
2018-05-18 09:23:48 +02:00
BuildRequires : %{python_module six}
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
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
# Run each test as a separate process, otherwise multiple app
# instances will corrupt each others static data
# 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
2022-08-14 16:40:17 +02:00
%{python_sitearch} /wxPython-*-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