File python-opengl.spec of Package python-opengl

# spec file for package python-opengl
# Copyright (c) 2019 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

# The tests depend on pygame, which is not available on all arch
%ifarch %{arm} aarch64 x86_64 %{ix86}
%bcond_without  check
%bcond_with     check
%ifarch x86_64 aarch64
%bcond_without  test_buffer_api_basic
%bcond_with     test_buffer_api_basic
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define tarname PyOpenGL
Name:           python-opengl
Version:        3.1.3b2
Release:        0
Summary:        OpenGL bindings for Python
License:        BSD-3-Clause
Group:          Development/Libraries/Python
BuildRequires:  %{python_module setuptools}
%if %{with check}
BuildRequires:  %{python_module Pillow}
BuildRequires:  %{python_module opengl-accelerate}
BuildRequires:  %{python_module psutil}
BuildRequires:  %{python_module pygame}
BuildRequires:  %{python_module pytest}
BuildRequires:  Mesa-dri
BuildRequires:  freeglut-devel
BuildRequires:  libdrm-devel
BuildRequires:  libgle-devel
BuildRequires:  python3-numpy
BuildRequires:  swig
BuildRequires:  tk-devel
BuildRequires:  xvfb-run
BuildRequires:  pkgconfig(gl)
BuildRequires:  pkgconfig(glu)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xcb-glx)
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
Recommends:     python-numpy
Recommends:     python-opengl-accelerate
Recommends:     python-tk
Recommends:     tk >= 8.1
BuildArch:      noarch

OpenGL bindings for Python including support for GL extensions, GLU,
WGL, GLUT, GLE, and Tk.

%setup -q -n %{tarname}-%{version}
# remove shebang
sed -e '1d' -i OpenGL/arrays/ OpenGL/arrays/
# avoid "python-bytecode-inconsistent-mtime" warning
FAKE_TIMESTAMP=$(LC_ALL=C date -u -r OpenGL/ +%%y%%m%%d%%H%%M)
find . -name '*.py' -exec touch -mat $FAKE_TIMESTAMP {} \;


%python_expand %fdupes -s %{buildroot}%{$python_sitelib}

%if %{with check}
# test_buffer_api_basic is a test specific to opengl-accelerate, failing on i586 and armv7l
%{python_expand #
%if %{with test_buffer_api_basic}
xvfb-run -s "-screen 0 1400x900x24 +iglx" $python -m pytest -v tests
xvfb-run -s "-screen 0 1400x900x24 +iglx" $python -m pytest -v tests -k "not test_buffer_api_basic"

%files %{python_files}
%license license.txt

openSUSE Build Service is sponsored by