5804b9a
%global oldname wx-phoenix-gtk3
5804b9a
%global pkgname wxpython4
5804b9a
%global py2_builddir python2
5804b9a
%global py3_builddir python3
5804b9a
%global srcname wxPython
5804b9a
%bcond_without tests
5804b9a
%global sum New implementation of wxPython, a GUI toolkit for Python
5804b9a
%global desc \
5804b9a
wxPython4 is a is a new implementation of wxPython focused on improving speed,\
5804b9a
maintainability and extensibility. Just like "Classic" wxPython it wraps the\
5804b9a
wxWidgets C++ toolkit and provides access to the user interface portions of the\
5804b9a
wx API, enabling Python applications to have a GUI on Windows, Macs or Unix\
5804b9a
systems with a native look and feel and requiring very little (if any) platform\
5804b9a
specific code.
5804b9a
5804b9a
Name:           python-wxpython4
5804b9a
Version:        4.0.1
3233905
Release:        5%{?dist}
5804b9a
Summary:        %{sum}
5804b9a
# wxPython is licensed under the wxWidgets license.  The only exception is
5804b9a
# the pubsub code in wx/lib/pubsub which is BSD licensed.  Note: wxPython
5804b9a
# includes a bundled copy of wxWidgets in ext/wxWidgets which has a few
5804b9a
# bits of code that use other licenses.  This source is not used in the
5804b9a
# Fedora build, except for the interface headers in ext/wxWidgets/interface
5804b9a
# and the doxygen build scripts.
5804b9a
License:        wxWidgets and BSD
5804b9a
URL:            https://www.wxpython.org/
5804b9a
Source0:        https://files.pythonhosted.org/packages/source/w/%{srcname}/%{srcname}-%{version}.tar.gz
5804b9a
Patch0:         unbundle-sip.patch
5804b9a
2e8895b
BuildRequires:  gcc-c++
5804b9a
BuildRequires:  doxygen
5804b9a
BuildRequires:  wxGTK3-devel
5804b9a
# For tests
5804b9a
%if %{with tests}
5804b9a
BuildRequires:  xorg-x11-server-Xvfb
5804b9a
BuildRequires:  python2-numpy python3-numpy
5804b9a
BuildRequires:  python2-PyPDF2 python3-PyPDF2
5804b9a
BuildRequires:  python2-pytest python3-pytest
5804b9a
BuildRequires:  python2-pytest-xdist python3-pytest-xdist
5804b9a
%endif
5804b9a
5804b9a
%description %{desc}
5804b9a
5804b9a
%package -n python2-%{pkgname}
5804b9a
Summary:        %{sum}
5804b9a
%{?python_provide:%python_provide python2-%{pkgname}}
5804b9a
BuildRequires:  python2-devel
5804b9a
BuildRequires:  python2-setuptools
5804b9a
BuildRequires:  python2-six
5804b9a
%if 0%{?fedora} > 27
5804b9a
BuildRequires:  python2-sip-devel >= 4.19.1
5804b9a
%else
5804b9a
BuildRequires:  sip-devel >= 4.19.1
5804b9a
%endif
5804b9a
Requires:       python2-six
5804b9a
%if 0%{?fedora} > 27
5804b9a
Requires:       python2-sip >= 4.19.1
5804b9a
%else
5804b9a
Requires:       sip >= 4.19.1
5804b9a
%endif
5804b9a
# Replace COPR package names
5804b9a
Provides:       python2-%{oldname} = %{version}-%{release}
5804b9a
Obsoletes:      python2-%{oldname} < %{version}-%{release}
5804b9a
5804b9a
%description -n python2-%{pkgname} %{desc}
5804b9a
5804b9a
%package -n python2-%{pkgname}-media
5804b9a
Summary:        %{sum} (media module)
5804b9a
%{?python_provide:%python_provide python2-%{pkgname}-media}
5804b9a
Requires:       python2-%{pkgname}%{?_isa} = %{version}-%{release}
5804b9a
5804b9a
%description -n python2-%{pkgname}-media %{desc}
5804b9a
This package provides the wx.media module.
5804b9a
5804b9a
%package -n python2-%{pkgname}-webview
5804b9a
Summary:        %{sum} (webview module)
5804b9a
%{?python_provide:%python_provide python2-%{pkgname}-webview}
5804b9a
Requires:       python2-%{pkgname}%{?_isa} = %{version}-%{release}
5804b9a
5804b9a
%description -n python2-%{pkgname}-webview %{desc}
5804b9a
This package provides the wx.html2 module.
5804b9a
5804b9a
%package -n python3-%{pkgname}
5804b9a
Summary:        %{sum}
5804b9a
%{?python_provide:%python_provide python3-%{pkgname}}
5804b9a
BuildRequires:  python3-devel
5804b9a
BuildRequires:  python3-setuptools
5804b9a
BuildRequires:  python3-sip-devel >= 4.19.1
5804b9a
BuildRequires:  python3-six
5804b9a
Requires:       python3-sip >= 4.19.1
5804b9a
Requires:       python3-six
5804b9a
# Replace COPR package names
5804b9a
Provides:       python3-%{oldname} = %{version}-%{release}
5804b9a
Obsoletes:      python3-%{oldname} < %{version}-%{release}
5804b9a
5804b9a
%description -n python3-%{pkgname} %{desc}
5804b9a
5804b9a
%package -n python3-%{pkgname}-media
5804b9a
Summary:        %{sum} (media module)
5804b9a
%{?python_provide:%python_provide python3-%{pkgname}-media}
5804b9a
Requires:       python3-%{pkgname}%{?_isa} = %{version}-%{release}
5804b9a
5804b9a
%description -n python3-%{pkgname}-media %{desc}
5804b9a
This package provides the wx.media module.
5804b9a
5804b9a
%package -n python3-%{pkgname}-webview
5804b9a
Summary:        %{sum} (webview module)
5804b9a
%{?python_provide:%python_provide python3-%{pkgname}-webview}
5804b9a
Requires:       python3-%{pkgname}%{?_isa} = %{version}-%{release}
5804b9a
5804b9a
%description -n python3-%{pkgname}-webview %{desc}
5804b9a
This package provides the wx.html2 module.
5804b9a
5804b9a
%package        doc
5804b9a
Summary:        Documentation and samples for wxPython
5804b9a
BuildArch:      noarch
5804b9a
# Replace COPR package names
5804b9a
Provides:       python-wx-phoenix-docs = %{version}-%{release}
5804b9a
Obsoletes:      python-wx-phoenix-docs < %{version}-%{release}
5804b9a
5804b9a
%description doc
5804b9a
Documentation, samples and demo application for wxPython.
5804b9a
5804b9a
5804b9a
%prep
5804b9a
%setup -c -q
5804b9a
5804b9a
mv %{srcname}-%{version} %{py2_builddir}
5804b9a
pushd %{py2_builddir}
5804b9a
%patch0 -p1
5804b9a
sed -i -e "s|WX_CONFIG = 'wx-config'|WX_CONFIG = 'wx-config-3.0'|" build.py
5804b9a
rm -rf sip/siplib
5804b9a
rm -rf wx/py/tests
5804b9a
rm -f docs/sphinx/_downloads/i18nwxapp/i18nwxapp.zip
5804b9a
cp -a wx/lib/pubsub/LICENSE_BSD_Simple.txt license
5804b9a
# Remove env shebangs from various files
5804b9a
sed -i -e '/^#!\//, 1d' demo/*.py{,w}
5804b9a
sed -i -e '/^#!\//, 1d' demo/agw/*.py
5804b9a
sed -i -e '/^#!\//, 1d' docs/sphinx/_downloads/i18nwxapp/*.py
5804b9a
sed -i -e '/^#!\//, 1d' samples/floatcanvas/*.py
5804b9a
sed -i -e '/^#!\//, 1d' samples/mainloop/*.py
5804b9a
sed -i -e '/^#!\//, 1d' samples/ribbon/*.py
5804b9a
sed -i -e '/^#!\//, 1d' wx/py/*.py
5804b9a
sed -i -e '/^#!\//, 1d' wx/tools/*.py
5804b9a
# Fix end of line encodings
5804b9a
sed -i 's/\r$//' docs/sphinx/_downloads/*.py
5804b9a
sed -i 's/\r$//' docs/sphinx/rest_substitutions/snippets/python/contrib/*.py
5804b9a
sed -i 's/\r$//' docs/sphinx/rest_substitutions/snippets/python/converted/*.py
5804b9a
sed -i 's/\r$//' docs/sphinx/_downloads/i18nwxapp/locale/I18Nwxapp.pot
5804b9a
sed -i 's/\r$//' docs/sphinx/make.bat
5804b9a
sed -i 's/\r$//' docs/sphinx/phoenix_theme/theme.conf
5804b9a
sed -i 's/\r$//' samples/floatcanvas/BouncingBall.py
5804b9a
# Remove spurious executable perms
5804b9a
chmod -x demo/*.py
5804b9a
chmod -x samples/mainloop/mainloop.py
5804b9a
chmod -x samples/printing/sample-text.txt
5804b9a
# Remove empty files
5804b9a
find demo -size 0 -delete
5804b9a
find docs/sphinx/rest_substitutions/snippets/python/converted -size 0 -delete
5804b9a
# Convert files to UTF-8
5804b9a
for file in demo/TestTable.txt docs/sphinx/_downloads/i18nwxapp/locale/I18Nwxapp.pot docs/sphinx/class_summary.pkl docs/sphinx/wx.1moduleindex.pkl; do
5804b9a
    iconv -f ISO-8859-1 -t UTF-8 -o $file.new $file && \
5804b9a
    touch -r $file $file.new && \
5804b9a
    mv $file.new $file
5804b9a
done
5804b9a
popd
5804b9a
cp -a %{py2_builddir} %{py3_builddir}
5804b9a
5804b9a
5804b9a
%build
5804b9a
pushd %{py2_builddir}
5804b9a
DOXYGEN=%{_bindir}/doxygen SIP=%{_bindir}/sip %{__python2} -u build.py dox touch etg --nodoc sip build_py --use_syswx --gtk3 bdist_egg
5804b9a
popd
5804b9a
pushd %{py3_builddir}
5804b9a
DOXYGEN=%{_bindir}/doxygen SIP=%{_bindir}/python3-sip %{__python3} -u build.py dox touch etg --nodoc sip build_py --use_syswx --gtk3
5804b9a
popd
5804b9a
5804b9a
5804b9a
%install
5804b9a
mkdir -p %{buildroot}%{python2_sitearch}
5804b9a
pushd %{py2_builddir}
5804b9a
easy_install -m -d %{buildroot}%{python2_sitearch} -Z dist/*.egg
5804b9a
popd
5804b9a
pushd %{py3_builddir}
5804b9a
%{__python3} build.py install_py --destdir=%{buildroot}
5804b9a
popd
5804b9a
find %{buildroot}%{python2_sitearch} -mindepth 1 -maxdepth 1 -not -name 'wxPython*' | xargs rm
5804b9a
rm -f %{buildroot}%{_bindir}/*
5804b9a
# Remove locale files (they are provided by wxWidgets)
5804b9a
rm -rf %{buildroot}%{python2_sitearch}/wx*/wx/locale
5804b9a
rm -rf %{buildroot}%{python3_sitearch}/wx/locale
5804b9a
5804b9a
%check
5804b9a
%if %{with tests}
5804b9a
pushd %{py2_builddir}
5804b9a
xvfb-run -a %{__python2} build.py test --verbose || true
5804b9a
popd
5804b9a
pushd %{py3_builddir}
5804b9a
xvfb-run -a %{__python3} build.py test --verbose || true
5804b9a
popd
5804b9a
%endif
5804b9a
5804b9a
5804b9a
%files -n python2-%{pkgname}
5804b9a
%license %{py2_builddir}/license/*
5804b9a
%{python2_sitearch}/*
5804b9a
%exclude %{python2_sitearch}/wx*/wx/*html2*
5804b9a
%exclude %{python2_sitearch}/wx*/wx/*media*
5804b9a
5804b9a
%files -n python2-%{pkgname}-media
5804b9a
%{python2_sitearch}/wx*/wx/*media*
5804b9a
5804b9a
%files -n python2-%{pkgname}-webview
5804b9a
%{python2_sitearch}/wx*/wx/*html2*
5804b9a
5804b9a
%files -n python3-%{pkgname}
5804b9a
%license %{py3_builddir}/license/*
5804b9a
%{python3_sitearch}/*
5804b9a
%exclude %{python3_sitearch}/wx/*html2*
5804b9a
%exclude %{python3_sitearch}/wx/__pycache__/*html2*
5804b9a
%exclude %{python3_sitearch}/wx/*media*
5804b9a
%exclude %{python3_sitearch}/wx/__pycache__/*media*
5804b9a
5804b9a
%files -n python3-%{pkgname}-media
5804b9a
%{python3_sitearch}/wx/*media*
5804b9a
%{python3_sitearch}/wx/__pycache__/*media*
5804b9a
5804b9a
%files -n python3-%{pkgname}-webview
5804b9a
%{python3_sitearch}/wx/*html2*
5804b9a
%{python3_sitearch}/wx/__pycache__/*html2*
5804b9a
5804b9a
%files doc
5804b9a
%doc %{py2_builddir}/docs %{py2_builddir}/demo %{py2_builddir}/samples
5804b9a
%license %{py3_builddir}/license/*
5804b9a
5804b9a
5804b9a
%changelog
3233905
* Tue Jun 19 2018 Miro HronĨok <mhroncok@redhat.com> - 4.0.1-5
3233905
- Rebuilt for Python 3.7
3233905
2e8895b
* Mon Feb 19 2018 Scott Talbert <swt@techie.net> - 4.0.1-4
2e8895b
- Add missing BR for gcc-c++
2e8895b
5804b9a
* Thu Feb 15 2018 Scott Talbert <swt@techie.net> - 4.0.1-3
5804b9a
- Second round of review comment fixes
5804b9a
5804b9a
* Tue Feb 13 2018 Scott Talbert <swt@techie.net> - 4.0.1-2
5804b9a
- Address initial review comments
5804b9a
- Fix rpmlint errors
5804b9a
- Fix and enable tests (but they are still not required to pass)
5804b9a
5804b9a
* Wed Feb 07 2018 Scott Talbert <swt@techie.net> - 4.0.1-1
5804b9a
- Initial packaging