File python-wxWidgets.spec of Package python-wxWidgets
#
# spec file for package python-wxWidgets
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: python-wxWidgets
%define srcname wxPython
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: python-devel
BuildRequires: python-xml
BuildRequires: wxWidgets-devel
Version: 2.8.12.1
Release: 0
%define wx_version %(echo %{version} | sed 's/\.[0-9][0-9]*\.[0-9][0-9]*$//')
%define wx_release %(echo %{version} | sed 's/\.[0-9][0-9]*$//')
Summary: Python Bindings for wxWidgets
License: GPL-2.0+
Group: System/Libraries
# Trick: OSC checks for the first one, RPM for the second one.
%if 0
# Source from http://www.wxpython.org/ contains complete wxWidgets
# source tree and proprietary Microsoft Visual Studio DLLs.
# We will repackage only a needed subset of files.
Source: http://downloads.sourceforge.net/wxpython/%{srcname}-src-%{version}.tar.bz2
%else
# WARNING: This is not a comment, but the real command to repack souce:
#%(sh %{_sourcedir}/%{name}-extract-source %{srcname}-src-%{version}.tar.bz2)
Source: %{srcname}-%{version}.tar.bz2
%endif
Source1: rpmlintrc
Source2: %{name}-extract-source
Url: http://www.wxpython.org/
# Used up to openSUSE 11.3:
Provides: python-wxGTK = %{version}
Obsoletes: python-wxGTK < %{version}
# Upstream name, never used in SUSE:
Provides: wxPython = %{version}
# Third party packages name, never used in SUSE:
Provides: wxPython%{wx_version}-gtk2-unicode = %{version}
# In fact it should be >= %{version} but only version < 2.9
Recommends: python-wxWidgets-lang = %{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Patch5: wxPython-missing_return.patch
Patch7: wxPython-abi.patch
Patch8: wxPython-no-strict-aliasing.patch
Patch9: wxPython-no-GraphicsRenderer-CreateBitmap.patch
Patch10: wxPython-platlib.patch
%py_requires
%define _use_internal_dependency_generator 0
%define __find_requires %wx_requires
%description
wxWidgets is a free C++ library for cross-platform GUI. This package contains python bindings for wxWidgets.
%package devel
Summary: Everything needed for development with wxGTK
Group: Development/Libraries/GNOME
# Name up to openSUSE 11.3 and up to wxGTK-2.8.x:
Provides: wxGTK-devel:%{_includedir}/wx-2.8/wx/wxPython/wxPython.h
%description devel
wxWidgets is a free C++ library for cross-platform GUI development.
With wxWidgets, you can create applications for different GUIs (GTK+,
Motif, MS Windows, MacOS X, Windows CE, GPE) from the same source code.
This package contains all files needed for developing with python
bindings for wxGTK.
%package lang
# We cannot use %%lang_package here. Editra translations use noarch incompatible path.
Summary: Languages for package python-wxWidgets
Group: System/Localization
Requires: %{name} = %{version}
Provides: %{name}-lang-all = %{version}
Supplements: packageand(bundle-lang-other:%{name})
%description lang
Provides translations to the package %{name}
%prep
# osc does not support BuildRequires with exact version defined by macro. Check it now.
if test "`rpm -q --queryformat=%{VERSION} wxWidgets-devel`" != "%{wx_release}" ; then
echo "To compile %{name} = %{version}, you need wxWidgets-devel = %{wx_version}"
exit 1
fi
%setup -q -n %{srcname}-src-%{version}
%patch5
%patch7
%patch8
%patch9
%patch10
cp %{S:1} .
%build
cd wxPython
python setup.py\
build
%install
# python-wxWidgets requires exact release of wxWidgets (bnc#740950).
cat >pywx_requires <<EOF
#!/bin/sh
%wx_requires |
while read ; do
case "\$REPLY" in
libwx_* ) echo "\$REPLY" = %{wx_release} ;;
* ) echo "\$REPLY" ;;
esac
done
EOF
chmod +x pywx_requires
%define __find_requires %{_builddir}/%{srcname}-src-%{version}/pywx_requires
cd wxPython
python setup.py\
install\
--prefix=%{_prefix}\
--root=$RPM_BUILD_ROOT
cd ..
# Create %%lang tags for mo files in non-standard path:
echo "%%defattr(-, root, root)" >Editra.lang
for LNG_DIR in $RPM_BUILD_ROOT%{py_sitedir}/wx*/wx/tools/Editra/locale/* ; do
LNG=${LNG_DIR##*/}
echo "%%lang($LNG) %%{py_sitedir}${LNG_DIR#$RPM_BUILD_ROOT%{py_sitedir}}" >>Editra.lang
done
%fdupes $RPM_BUILD_ROOT%{_libdir}
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-, root, root)
%doc wxPython/docs/*.txt wxPython/docs/*.html wxPython/docs/screenshots wxPython/licence
%{_bindir}/*
%if %suse_version > 1110
%{python_sitearch}/*
%{python_sitelib}/*
%exclude %{python_sitearch}/wx*/wx/tools/Editra/locale/*
%else
%{py_sitedir}/*
%exclude %{py_sitedir}/wx*/wx/tools/Editra/locale/*
%endif
%files lang -f Editra.lang
%files devel
%defattr(-, root, root)
%{_includedir}/wx-%{wx_version}/wx/wxPython
%changelog