File python-gamera.spec of Package python-gamera

#
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#

%define packagename gamera
Name:           python-%{packagename}
Version:        3.4.3
Release:        0
License:        GPL-2.0+
Summary:        Framework for writing document analysis applications
Url:            https://gamera.informatik.hsnr.de/
Group:          Development/Libraries/Python
Source:         https://sourceforge.net/projects/gamera/files/gamera/gamera-%{version}/%{packagename}-%{version}.tar.gz
Source1:        gamera_gui.1
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

BuildRequires:  gcc-c++
BuildRequires:  libjpeg-devel
BuildRequires:  libpng-devel
BuildRequires:  libtiff-devel
BuildRequires:  python-devel
%if %{defined fedora}
BuildRequires:  wxPython
%else
%if 0%{?suse_version}
BuildRequires:  python-wxGTK
BuildRequires:  python-wxWidgets
%endif
%py_requires
%endif

%description
Gamera is a framework for building document analysis applications.
It is not a packaged document recognition system, but a toolkit for
building document image recognition systems.

For more information about Gamera, visit the Gamera website at:

        https://gamera.informatik.hsnr.de/

%package devel
Summary:        Development files for Gamera framework
Group:          Development/Libraries/Python
%if 0%{?suse_version}
%py_requires -d
%endif

%description devel
Development part of gamera framework
Gamera is a framework for building document analysis applications.
It is not a packaged document recognition system, but a toolkit for
building document image recognition systems.

For more information about Gamera, visit the Gamera website at:

        https://gamera.informatik.hsnr.de/

%prep
%setup  -n %{packagename}-%{version}
# Fix permissions on files
find . -name "*.hpp" -exec chmod 644 {} ';'
find . -name README -exec chmod 644 {} ';'
# remove shebang
find gamera -name "*.py" -exec sed -i '/^#!\/usr\/bin\/env python$/d' {} ";"
%build
python setup.py build

%install
python setup.py install --root=%{buildroot} --prefix=%{_prefix} --record-rpm installed.files
install -Dm0644 %{S:1} %{buildroot}%{_mandir}/man1/gamera_gui.1
echo "%{_mandir}/man1/gamera_gui.1*" >> installed.files

grep -v 'doc/packages$' installed.files > installed.files.temp.$$ && mv installed.files.temp.$$ installed.files
# move devel files into devel package listing (hxx cpp hpp files)
grep '\.hxx$' installed.files > installed-devel.files
grep '\..pp$' installed.files >> installed-devel.files

# remove devel files from main listing
grep -v '\.hxx$' installed.files > installed.files.temp.$$ && mv installed.files.temp.$$ installed.files
grep -v '\..pp$' installed.files > installed.files.temp.$$ && mv installed.files.temp.$$ installed.files

%clean
rm -rf %{buildroot}

%files -f installed.files
%defattr(-,root,root)
%doc README

%files devel -f installed-devel.files
%defattr(-,root,root)
%doc README

%changelog
openSUSE Build Service is sponsored by