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 http://bugs.opensuse.org/
#


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

# 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.
#DL-URL:	http://downloads.sourceforge.net/wxpython/%srcname-src-%version.tar.bz2
Source:         %srcname-%version.tar.xz
Source2:        %name-rpmlintrc
Source3:        extract-source.sh
Source4:        pre_checkin.sh
Patch1:         wxPython-platlib.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  perl
BuildRequires:  python2-devel
BuildRequires:  python2-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
Provides:       python2-wxWidgets = %version
Conflicts:      otherproviders(python-wxWidgets)
Conflicts:      otherproviders(python2-wxWidgets)

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

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

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

python2 setup.py build
popd

%install
# 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/
python2 setup.py install --prefix="%_prefix" --root="%buildroot"
popd

# 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
	LNG="${LNG_DIR##*/}"
	echo "%%lang($LNG) %%py_sitedir${LNG_DIR#%buildroot/%py_sitedir}" >>Editra.lang
done
%fdupes %buildroot/%_prefix

%files
%defattr(-,root,root)
%doc wxPython/docs/*.txt wxPython/docs/*.html wxPython/docs/screenshots wxPython/licence
%_bindir/*
%python_sitearch/*
%python_sitelib/*
%exclude %python_sitearch/wx*/wx/tools/Editra/locale/*

%files lang -f Editra.lang

%files devel
%defattr(-,root,root)
%_includedir/wx-%wx_version/

%changelog
openSUSE Build Service is sponsored by