From 5804b9af7b787cbb8aee8d6e5c7fc1193d4320cf Mon Sep 17 00:00:00 2001 From: Scott Talbert Date: Feb 16 2018 01:26:04 +0000 Subject: Initial import --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2096b48 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/wxPython-4.0.1.tar.gz diff --git a/python-wxpython4.spec b/python-wxpython4.spec new file mode 100644 index 0000000..2b6e7f7 --- /dev/null +++ b/python-wxpython4.spec @@ -0,0 +1,247 @@ +%global oldname wx-phoenix-gtk3 +%global pkgname wxpython4 +%global py2_builddir python2 +%global py3_builddir python3 +%global srcname wxPython +%bcond_without tests +%global sum New implementation of wxPython, a GUI toolkit for Python +%global desc \ +wxPython4 is a is a new implementation of wxPython focused on improving speed,\ +maintainability and extensibility. Just like "Classic" wxPython it wraps the\ +wxWidgets C++ toolkit and provides access to the user interface portions of the\ +wx API, enabling Python applications to have a GUI on Windows, Macs or Unix\ +systems with a native look and feel and requiring very little (if any) platform\ +specific code. + +Name: python-wxpython4 +Version: 4.0.1 +Release: 3%{?dist} +Summary: %{sum} +# wxPython is licensed under the wxWidgets license. The only exception is +# the pubsub code in wx/lib/pubsub which is BSD licensed. Note: wxPython +# includes a bundled copy of wxWidgets in ext/wxWidgets which has a few +# bits of code that use other licenses. This source is not used in the +# Fedora build, except for the interface headers in ext/wxWidgets/interface +# and the doxygen build scripts. +License: wxWidgets and BSD +URL: https://www.wxpython.org/ +Source0: https://files.pythonhosted.org/packages/source/w/%{srcname}/%{srcname}-%{version}.tar.gz +Patch0: unbundle-sip.patch + +BuildRequires: doxygen +BuildRequires: wxGTK3-devel +# For tests +%if %{with tests} +BuildRequires: xorg-x11-server-Xvfb +BuildRequires: python2-numpy python3-numpy +BuildRequires: python2-PyPDF2 python3-PyPDF2 +BuildRequires: python2-pytest python3-pytest +BuildRequires: python2-pytest-xdist python3-pytest-xdist +%endif + +%description %{desc} + +%package -n python2-%{pkgname} +Summary: %{sum} +%{?python_provide:%python_provide python2-%{pkgname}} +BuildRequires: python2-devel +BuildRequires: python2-setuptools +BuildRequires: python2-six +%if 0%{?fedora} > 27 +BuildRequires: python2-sip-devel >= 4.19.1 +%else +BuildRequires: sip-devel >= 4.19.1 +%endif +Requires: python2-six +%if 0%{?fedora} > 27 +Requires: python2-sip >= 4.19.1 +%else +Requires: sip >= 4.19.1 +%endif +# Replace COPR package names +Provides: python2-%{oldname} = %{version}-%{release} +Obsoletes: python2-%{oldname} < %{version}-%{release} + +%description -n python2-%{pkgname} %{desc} + +%package -n python2-%{pkgname}-media +Summary: %{sum} (media module) +%{?python_provide:%python_provide python2-%{pkgname}-media} +Requires: python2-%{pkgname}%{?_isa} = %{version}-%{release} + +%description -n python2-%{pkgname}-media %{desc} +This package provides the wx.media module. + +%package -n python2-%{pkgname}-webview +Summary: %{sum} (webview module) +%{?python_provide:%python_provide python2-%{pkgname}-webview} +Requires: python2-%{pkgname}%{?_isa} = %{version}-%{release} + +%description -n python2-%{pkgname}-webview %{desc} +This package provides the wx.html2 module. + +%package -n python3-%{pkgname} +Summary: %{sum} +%{?python_provide:%python_provide python3-%{pkgname}} +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-sip-devel >= 4.19.1 +BuildRequires: python3-six +Requires: python3-sip >= 4.19.1 +Requires: python3-six +# Replace COPR package names +Provides: python3-%{oldname} = %{version}-%{release} +Obsoletes: python3-%{oldname} < %{version}-%{release} + +%description -n python3-%{pkgname} %{desc} + +%package -n python3-%{pkgname}-media +Summary: %{sum} (media module) +%{?python_provide:%python_provide python3-%{pkgname}-media} +Requires: python3-%{pkgname}%{?_isa} = %{version}-%{release} + +%description -n python3-%{pkgname}-media %{desc} +This package provides the wx.media module. + +%package -n python3-%{pkgname}-webview +Summary: %{sum} (webview module) +%{?python_provide:%python_provide python3-%{pkgname}-webview} +Requires: python3-%{pkgname}%{?_isa} = %{version}-%{release} + +%description -n python3-%{pkgname}-webview %{desc} +This package provides the wx.html2 module. + +%package doc +Summary: Documentation and samples for wxPython +BuildArch: noarch +# Replace COPR package names +Provides: python-wx-phoenix-docs = %{version}-%{release} +Obsoletes: python-wx-phoenix-docs < %{version}-%{release} + +%description doc +Documentation, samples and demo application for wxPython. + + +%prep +%setup -c -q + +mv %{srcname}-%{version} %{py2_builddir} +pushd %{py2_builddir} +%patch0 -p1 +sed -i -e "s|WX_CONFIG = 'wx-config'|WX_CONFIG = 'wx-config-3.0'|" build.py +rm -rf sip/siplib +rm -rf wx/py/tests +rm -f docs/sphinx/_downloads/i18nwxapp/i18nwxapp.zip +cp -a wx/lib/pubsub/LICENSE_BSD_Simple.txt license +# Remove env shebangs from various files +sed -i -e '/^#!\//, 1d' demo/*.py{,w} +sed -i -e '/^#!\//, 1d' demo/agw/*.py +sed -i -e '/^#!\//, 1d' docs/sphinx/_downloads/i18nwxapp/*.py +sed -i -e '/^#!\//, 1d' samples/floatcanvas/*.py +sed -i -e '/^#!\//, 1d' samples/mainloop/*.py +sed -i -e '/^#!\//, 1d' samples/ribbon/*.py +sed -i -e '/^#!\//, 1d' wx/py/*.py +sed -i -e '/^#!\//, 1d' wx/tools/*.py +# Fix end of line encodings +sed -i 's/\r$//' docs/sphinx/_downloads/*.py +sed -i 's/\r$//' docs/sphinx/rest_substitutions/snippets/python/contrib/*.py +sed -i 's/\r$//' docs/sphinx/rest_substitutions/snippets/python/converted/*.py +sed -i 's/\r$//' docs/sphinx/_downloads/i18nwxapp/locale/I18Nwxapp.pot +sed -i 's/\r$//' docs/sphinx/make.bat +sed -i 's/\r$//' docs/sphinx/phoenix_theme/theme.conf +sed -i 's/\r$//' samples/floatcanvas/BouncingBall.py +# Remove spurious executable perms +chmod -x demo/*.py +chmod -x samples/mainloop/mainloop.py +chmod -x samples/printing/sample-text.txt +# Remove empty files +find demo -size 0 -delete +find docs/sphinx/rest_substitutions/snippets/python/converted -size 0 -delete +# Convert files to UTF-8 +for file in demo/TestTable.txt docs/sphinx/_downloads/i18nwxapp/locale/I18Nwxapp.pot docs/sphinx/class_summary.pkl docs/sphinx/wx.1moduleindex.pkl; do + iconv -f ISO-8859-1 -t UTF-8 -o $file.new $file && \ + touch -r $file $file.new && \ + mv $file.new $file +done +popd +cp -a %{py2_builddir} %{py3_builddir} + + +%build +pushd %{py2_builddir} +DOXYGEN=%{_bindir}/doxygen SIP=%{_bindir}/sip %{__python2} -u build.py dox touch etg --nodoc sip build_py --use_syswx --gtk3 bdist_egg +popd +pushd %{py3_builddir} +DOXYGEN=%{_bindir}/doxygen SIP=%{_bindir}/python3-sip %{__python3} -u build.py dox touch etg --nodoc sip build_py --use_syswx --gtk3 +popd + + +%install +mkdir -p %{buildroot}%{python2_sitearch} +pushd %{py2_builddir} +easy_install -m -d %{buildroot}%{python2_sitearch} -Z dist/*.egg +popd +pushd %{py3_builddir} +%{__python3} build.py install_py --destdir=%{buildroot} +popd +find %{buildroot}%{python2_sitearch} -mindepth 1 -maxdepth 1 -not -name 'wxPython*' | xargs rm +rm -f %{buildroot}%{_bindir}/* +# Remove locale files (they are provided by wxWidgets) +rm -rf %{buildroot}%{python2_sitearch}/wx*/wx/locale +rm -rf %{buildroot}%{python3_sitearch}/wx/locale + +%check +%if %{with tests} +pushd %{py2_builddir} +xvfb-run -a %{__python2} build.py test --verbose || true +popd +pushd %{py3_builddir} +xvfb-run -a %{__python3} build.py test --verbose || true +popd +%endif + + +%files -n python2-%{pkgname} +%license %{py2_builddir}/license/* +%{python2_sitearch}/* +%exclude %{python2_sitearch}/wx*/wx/*html2* +%exclude %{python2_sitearch}/wx*/wx/*media* + +%files -n python2-%{pkgname}-media +%{python2_sitearch}/wx*/wx/*media* + +%files -n python2-%{pkgname}-webview +%{python2_sitearch}/wx*/wx/*html2* + +%files -n python3-%{pkgname} +%license %{py3_builddir}/license/* +%{python3_sitearch}/* +%exclude %{python3_sitearch}/wx/*html2* +%exclude %{python3_sitearch}/wx/__pycache__/*html2* +%exclude %{python3_sitearch}/wx/*media* +%exclude %{python3_sitearch}/wx/__pycache__/*media* + +%files -n python3-%{pkgname}-media +%{python3_sitearch}/wx/*media* +%{python3_sitearch}/wx/__pycache__/*media* + +%files -n python3-%{pkgname}-webview +%{python3_sitearch}/wx/*html2* +%{python3_sitearch}/wx/__pycache__/*html2* + +%files doc +%doc %{py2_builddir}/docs %{py2_builddir}/demo %{py2_builddir}/samples +%license %{py3_builddir}/license/* + + +%changelog +* Thu Feb 15 2018 Scott Talbert - 4.0.1-3 +- Second round of review comment fixes + +* Tue Feb 13 2018 Scott Talbert - 4.0.1-2 +- Address initial review comments +- Fix rpmlint errors +- Fix and enable tests (but they are still not required to pass) + +* Wed Feb 07 2018 Scott Talbert - 4.0.1-1 +- Initial packaging diff --git a/sources b/sources new file mode 100644 index 0000000..8c07877 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (wxPython-4.0.1.tar.gz) = 4589c8ccd2e3cbb691c5ae5a25e83ae809e5c8c9265f0298ad2a858b2ea2c1794b3e5a1da19f3c6bc5a371143f96f964ff93911564fc8f4a1bc2b5fd1e9e83c9 diff --git a/unbundle-sip.patch b/unbundle-sip.patch new file mode 100644 index 0000000..5e50751 --- /dev/null +++ b/unbundle-sip.patch @@ -0,0 +1,146 @@ +From 3f9dc246ae660318d1e8b03fa7c410dfdc2a520e Mon Sep 17 00:00:00 2001 +From: Scott Talbert +Date: Sat, 20 Jan 2018 17:05:11 -0500 +Subject: [PATCH] Unbundle sip + +--- + etg/dataview.py | 4 ++-- + etg/grid.py | 4 ++-- + etg/sizer.py | 4 ++-- + etg/window.py | 4 ++-- + wscript | 20 +------------------- + wx/lib/gizmos/dynamicsash.py | 6 +++--- + 6 files changed, 12 insertions(+), 30 deletions(-) + +diff --git a/etg/dataview.py b/etg/dataview.py +index c0be8351..0a877a3f 100644 +--- a/etg/dataview.py ++++ b/etg/dataview.py +@@ -374,8 +374,8 @@ def run(): + is reference counted so it can be shared with other views. + """, + body="""\ +- import wx.siplib +- wasPyOwned = wx.siplib.ispyowned(model) ++ import sip ++ wasPyOwned = sip.ispyowned(model) + self._AssociateModel(model) + # Ownership of the python object has just been transferred to + # C++, so DecRef the C++ instance associated with this python +diff --git a/etg/grid.py b/etg/grid.py +index 47c1e0ce..097e9c86 100644 +--- a/etg/grid.py ++++ b/etg/grid.py +@@ -445,8 +445,8 @@ def run(): + body="""\ + val = self._SetTable(table, takeOwnership, selmode) + if takeOwnership: +- import wx.siplib +- wx.siplib.transferto(table, self) ++ import sip ++ sip.transferto(table, self) + return val + """) + +diff --git a/etg/sizer.py b/etg/sizer.py +index a5533eab..1335987f 100644 +--- a/etg/sizer.py ++++ b/etg/sizer.py +@@ -148,8 +148,8 @@ def run(): + " if theSizer:\n" + " doSomething()", + body="""\ +- import wx.siplib +- return not wx.siplib.isdeleted(self) ++ import sip ++ return not sip.isdeleted(self) + """) + c.addPyCode('Sizer.__bool__ = Sizer.__nonzero__') # For Python 3 + +diff --git a/etg/window.py b/etg/window.py +index be481ae6..a1bb0f7e 100644 +--- a/etg/window.py ++++ b/etg/window.py +@@ -178,8 +178,8 @@ def run(): + " if theWindow:\n" + " doSomething()", + body="""\ +- import wx.siplib +- return not wx.siplib.isdeleted(self) ++ import sip ++ return not sip.isdeleted(self) + """) + c.addPyCode('Window.__bool__ = Window.__nonzero__') # For Python 3 + +diff --git a/wscript b/wscript +index d051ebbc..9a3c26da 100644 +--- a/wscript ++++ b/wscript +@@ -96,7 +96,7 @@ def configure(conf): + conf.env.msvc_relwithdebug = conf.options.msvc_relwithdebug + + # Ensure that the headers in siplib and Phoenix's src dir can be found +- conf.env.INCLUDES_WXPY = ['sip/siplib', 'src'] ++ conf.env.INCLUDES_WXPY = ['src'] + + if isWindows: + # Windows/MSVC specific stuff +@@ -506,24 +506,6 @@ def build(bld): + + + # Create the build tasks for each of our extension modules. +- addRelwithdebugFlags(bld, 'siplib') +- siplib = bld( +- features = 'c cxx cshlib cxxshlib pyext', +- target = makeTargetName(bld, 'siplib'), +- source = ['sip/siplib/apiversions.c', +- 'sip/siplib/array.c', +- 'sip/siplib/bool.cpp', +- 'sip/siplib/descriptors.c', +- 'sip/siplib/int_convertors.c', +- 'sip/siplib/objmap.c', +- 'sip/siplib/qtlib.c', +- 'sip/siplib/siplib.c', +- 'sip/siplib/threads.c', +- 'sip/siplib/voidptr.c', +- ], +- uselib = 'siplib WX WXPY', +- ) +- makeExtCopyRule(bld, 'siplib') + + # Add build rules for each of our ETG generated extension modules + makeETGRule(bld, 'etg/_core.py', '_core', 'WX') +diff --git a/wx/lib/gizmos/dynamicsash.py b/wx/lib/gizmos/dynamicsash.py +index 03b2aebf..142129de 100644 +--- a/wx/lib/gizmos/dynamicsash.py ++++ b/wx/lib/gizmos/dynamicsash.py +@@ -16,7 +16,7 @@ reunified through the user interface. + """ + + import wx +-import wx.siplib ++import sip + + #---------------------------------------------------------------------------- + # Styles +@@ -945,7 +945,7 @@ class _DynamicSashWindowLeaf(wx.EvtHandler): + # we'll just save the object's address instead, and then use that to + # fetch the real proxy object when it's needed later. + self.m_child = None +- self.m_child_ptr = wx.siplib.unwrapinstance(window) ++ self.m_child_ptr = sip.unwrapinstance(window) + + # Delay the reparenting until after the AddChild has finished. + event = _DynamicSashReparentEvent(self) +@@ -954,7 +954,7 @@ class _DynamicSashWindowLeaf(wx.EvtHandler): + + def _checkPendingChild(self): + if hasattr(self, 'm_child_ptr'): +- self.m_child = wx.siplib.wrapinstance(self.m_child_ptr, wx.Object) ++ self.m_child = sip.wrapinstance(self.m_child_ptr, wx.Object) + del self.m_child_ptr + + +-- +2.14.3 +