File python-pygarrayimage.spec of Package python-pygarrayimage

#
# spec file for package python-pygarrayimage
#
# Copyright (c) 2018 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() python-%{**} python3-%{**}}
%define         X_display         ":98"
# TODO: Can't get Xvfb working with glx
%bcond_with     test
Name:           python-pygarrayimage
Version:        1.0
Release:        0
Summary:        Allow numpy arrays as source of texture data for pyglet
License:        BSD-3-Clause
Group:          Development/Languages/Python
Url:            http://code.astraw.com/projects/motmot/wiki/pygarrayimage
Source:         https://files.pythonhosted.org/packages/source/p/pygarrayimage/pygarrayimage-%{version}.tar.gz
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module numpy}
BuildRequires:  %{python_module pyglet}
BuildRequires:  %{python_module setuptools}
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
%if %{with test}
BuildRequires:  xorg-x11-server
%endif
Requires:       python-numpy
Requires:       python-pyglet
BuildArch:      noarch

%python_subpackages

%description
pygarrayimage allows display of Python objects supporting the array
interface as OpenGL textures without a copy. The OpenGL texture
handling is done using pyglet.

In other words, this allows fast transfer of data from numpy arrays
(or any other data source supporting the array interface) to the video
card.

%prep
%setup -q -n pygarrayimage-%{version}
# Remove unneeded git files
rm -rf */.gitignore

%build
%python_build

%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}

%if %{with test}
%check
#############################################
### Launch a virtual framebuffer X server ###
#############################################
export DISPLAY=%{X_display}
Xvfb %{X_display} >& Xvfb.log &
trap "kill $! || true" EXIT
sleep 10
# Do basic check to make sure it is importable
%python_expand $python -c "import pygarrayimage"
%python_expand $python -c "import pygarrayimage;import pygarrayimage.arrayimage"
%endif

%files %{python_files}
%defattr(-,root,root,-)
%doc README.rst
%{python_sitelib}/*

%changelog
openSUSE Build Service is sponsored by