File horus.spec of Package horus

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

%{?!python_module:%define python_module() python3-%{**}}
%define skip_python3 1
%bcond_without test
Name:           horus
Version:        0
Release:        1
License:        GPL-2.0
Summary:		3D Scan application for BQ Ciclop
Url:			https://github.com/bq/horus
Group:          Applications/Productivity
Source:			%{name}-%{version}.tar.xz
Patch1: fix-runtime.patch
Patch2: opencv3.patch
BuildRequires:  update-desktop-files ImageMagick
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module setuptools}
Requires:  %{python_module pyserial}
Requires:  python2-scipy
Requires:  python2-opencv > 3
Requires:  python2-matplotlib-wx

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

%python_subpackages

%prep
%setup -q
%patch1 -p1
%patch2 -p1

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

%install
%python_install

mkdir -p %buildroot/%_prefix/share/pixmaps
convert res/horus.ico %buildroot/%_prefix/share/pixmaps/horus.png
mv %buildroot/%_prefix/share/pixmaps/horus{-2,}.png
rm %buildroot/%_prefix/share/pixmaps/horus-*.png

# 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=/usr/bin/python %{python_sitelib}/horus/src/horus.py
Path=%{python_sitelib}/horus/
StartupNotify=true
Terminal=false
Categories=3DGraphics
EOF
cat >%buildroot/%_prefix/bin/horus <<EOF
#!/bin/sh
/usr/bin/python %{python_sitelib}/horus/src/horus.py "\$@"
EOF

%files
%defattr(-,root,root)
/usr/bin/horus
%{python_sitelib}/horus
%{python_sitelib}/Horus*.egg-info
/usr/share/applications/*
/usr/share/pixmaps/*

openSUSE Build Service is sponsored by