File python-wxWidgets-3_0.spec of Package python-wxWidgets-3_0

# spec file for package python-wxWidgets-3_0
# Copyright (c) 2017 SUSE LINUX 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

Name:           python-wxWidgets-3_0
%define srcname wxPython
Release:        0
Summary:        Python Bindings for wxWidgets
License:        GPL-2.0+
Group:          Development/Languages/Python
%define wx_version %(echo "%version" | perl -pe 's{\\.\\d+\\.\\d+$}{}')
%define wx_release %(echo "%version" | perl -pe 's{\\.\\d+$}{}')

# Source from contains complete wxWidgets
# source tree and proprietary Microsoft Visual Studio DLLs.
# We will repackage only a needed subset of files.
Source:         %srcname-%version.tar.xz
Source2:        %name-rpmlintrc
Patch1:         wxPython-platlib.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  perl
BuildRequires:  python-devel
BuildRequires:  python-xml
BuildRequires:  wxWidgets-3_0-devel
BuildRequires:  xz
#Requires:       wxWidgets-3_0 = %(rpm -q --qf="%%VERSION" wxWidgets-3_0)
# 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 < 3.1
Recommends:     %name-lang = %version
Provides:       python-wxWidgets = %version
Conflicts:      otherproviders(python-wxWidgets)

wxWidgets is a free C++ library for cross-platform GUI.
This package contains the Python bindings for wxWidgets.

%package devel
Summary:        Everything needed for development with wxPython
Group:          Development/Languages/Python
Requires:       %name = %version
Provides:       python-wxWidgets-devel = %version
Conflicts:      otherproviders(python-wxWidgets-devel)

%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.

%setup -qn %srcname-src-%version
%patch -P 1 -p1

pushd wxPython/

# kill off outdated header copies, use system headers instead
mv include/wx/wxPython wxpyinc
rm -Rf include/wx/
mkdir -p include/wx
mv wxpyinc include/wx/wxPython

python build

# bnc#740950… python-wxWidgets version a.b.c.d wants to run with wxWidgets
# a.b.c only. This however is not always possible: at the time of this writing,
# wxWidgets was already at 3.0.1 but most recent wxPython version is 3.0.0.
# The version mismatch causes a warning, but it might be fine if we ensure that
# the python module runs against the precise version *it was built with*.
pushd wxPython/
python install --prefix="%_prefix" --root="%buildroot"

# Create %%lang tags for mo files in non-standard path:
echo "%%defattr(-,root,root)" >Editra.lang
for LNG_DIR in "%buildroot/%py_sitedir"/wx*/wx/tools/Editra/locale/*; do
	echo "%%lang($LNG) %%py_sitedir${LNG_DIR#%buildroot/%py_sitedir}" >>Editra.lang
%fdupes %buildroot/%_prefix

%doc wxPython/docs/*.txt wxPython/docs/*.html wxPython/docs/screenshots wxPython/licence
%exclude %python_sitearch/wx*/wx/tools/Editra/locale/*

%files lang -f Editra.lang

%files devel