File horus.spec of Package horus

#
# spec file for package horus
#
# Copyright (c) 2022 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/
#


%bcond_without test

Name:           horus
Version:        0.2~rc1.20160610.e2c675f
Release:        0
License:        GPL-2.0-only
Summary:        3D Scan application for BQ Ciclop
URL:            https://github.com/LibreScanner/horus
Group:          Applications/Productivity
Source:         %{name}-%{version}.tar.xz
Patch1:         fix-runtime.patch
Patch2:         0001-Fix-print-and-exception-syntax-for-Python-3-compat.patch
Patch3:         0002-Update-deprecated-imports-xrange-unicode-to-Python3.patch
Patch4:         0003-Update-wxPython-syntax.patch
Patch5:         0004-OpenCV4-support.patch
BuildRequires:  fdupes
BuildRequires:  hicolor-icon-theme
BuildRequires:  icoutils
BuildRequires:  python-rpm-macros
BuildRequires:  python3-setuptools
BuildRequires:  update-desktop-files
Requires:       python3-pyserial
Requires:       python3-opencv
Requires:       python3-matplotlib-wx
BuildArch:      noarch

%description
Horus is a full software solution for 3D scanning

%prep
%autosetup -p1

%build
export CFLAGS="%{optflags}"
%python3_build

%install
%python3_install
sed -e '1 s/env python/python3/' < ./horus > %{buildroot}/%{_bindir}/horus

for s in 16 32 48 64 128 256 ; do
    mkdir -p %buildroot/%_prefix/share/icons/hicolor/${s}x${s}/apps
    icotool --extract --icon --width $s --output %buildroot/%_prefix/share/icons/hicolor/${s}x${s}/apps/horus.png res/horus.ico
done

# fix execution
mkdir -p %buildroot/%_prefix/share/applications
cat >%buildroot/%_prefix/share/applications/horus.desktop <<EOF
[Desktop Entry]
Type=Application
Name=Horus
Comment=Horus
Icon=horus
Exec=horus
StartupNotify=true
Terminal=false
Categories=3DGraphics
EOF

# Remove binary Windows/Mac stuff
rm -Rf %{buildroot}/%{_datadir}/horus/tools/{windows,darwin}

%fdupes %{buildroot}%{python3_sitelib}

%files
%{_bindir}/horus
%{python3_sitelib}/horus
%{python3_sitelib}/Horus*.egg-info
%{_datadir}/horus
%{_datadir}/applications/*
%{_datadir}/icons/hicolor/*/apps/*png

openSUSE Build Service is sponsored by