File python-gamera.spec of Package python-gamera

#
# spec file for package python-gamera
#
# Copyright (c) 2023 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


# exclude while 3.12 isn't default python in TW yet
%define skip_python312 1

%define packagename gamera
Name:           python-%{packagename}
Version:        4.1.0
Release:        0
Summary:        Framework for writing document analysis applications
License:        GPL-2.0-or-later
Group:          Development/Libraries/Python
URL:            https://gamera.informatik.hsnr.de/
Source:         https://sourceforge.net/projects/gamera/files/gamera/gamera-%{version}/%{packagename}-4-%{version}.tar.gz
Source1:        gamera_gui.1
BuildRequires:  %{python_module Cython}
BuildRequires:  %{python_module pip}
BuildRequires:  %{python_module setuptools}
BuildRequires:  %{python_module wheel}
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  libjpeg-devel
BuildRequires:  libpng-devel
BuildRequires:  libtiff-devel
BuildRequires:  python-rpm-macros
%if %{defined fedora}
BuildRequires:  wxPython
%else
%if 0%{?suse_version}
BuildRequires:  python3-wxPython
%endif
%endif
%python_subpackages

%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

%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 -q -n %{packagename}-4-%{version}
# remove shebang
find gamera -name "*.py" -exec sed -i '/^#!\/usr\/bin\/env python$/d' {} ";"

%build
%pyproject_wheel

%install
%pyproject_install
install -Dm0644 %{SOURCE1} %{buildroot}%{_mandir}/man1/gamera_gui.1

%python_expand %fdupes %{buildroot}%{$python_sitearch}

%python_clone -a %{buildroot}%{_bindir}/gamera_gui
%python_clone -a %{buildroot}%{_mandir}/man1/gamera_gui.1

%post
%python_install_alternative gamera_gui gamera_gui.1

%postun
%python_uninstall_alternative gamera_gui gamera_gui.1

%files %{python_files}
%license LICENSE
%doc README.md
%python_alternative %{_bindir}/gamera_gui
%python_alternative %{_mandir}/man1/gamera_gui.1
%dir %{python_sitearch}/gamera/
%dir %{python_sitearch}/gamera/test/
%dir %{python_sitearch}/gamera/toolkits/
%{python_sitearch}/gamera/*.py
%{python_sitearch}/gamera/*.so
%{python_sitearch}/gamera/backport/
%{python_sitearch}/gamera/gui/
%{python_sitearch}/gamera/pixmaps/
%{python_sitearch}/gamera/toolkits/__init__.py
%{python_sitearch}/gamera/test/*.tiff
%{python_sitearch}/doc/
%{python_sitearch}/examples/
%{python_sitearch}/misc/
%{python_sitearch}/tests/
%{python_sitearch}/gamera-%{version}.dist-info/
%pycache_only %{python_sitearch}/gamera/__pycache__
%pycache_only %{python_sitearch}/gamera/toolkits/__pycache__

%files %{python_files devel}
%license LICENSE
%doc README.md
%dir %{python_sitearch}/gamera/include/
%{python_sitearch}/gamera/include/gamera/
%{python_sitearch}/gamera/plugins/
%{python_sitearch}/gamera/src/
%{python_sitearch}/src/

%changelog
openSUSE Build Service is sponsored by