File python-pyheif.spec of Package python-pyheif

#
# spec file for package python-pyheif
#
# 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/
#


%{?!python_module:%define python_module() python3-%{**}}
%define skip_python2 1
# Enable this before submitting to Factory, needs test files from source repository (as done below)
# also needs the piexif module which is not currently in factory
%bcond_with test
Name:           python-pyheif
Version:        0.7.0
Release:        0
Summary:        Python 3.6+ interface to libheif library
License:        Apache-2.0
Group:          Development/Languages/Python
URL:            https://pypi.org/project/pyheif/
Source:         https://files.pythonhosted.org/packages/ca/p/pyheif/pyheif-%{version}.tar.gz
# retrieved test folder from git
# git clone https://github.com/carsales/pyheif.git
Source1:        tests.tar.gz
BuildRequires:  %{python_module cffi}
BuildRequires:  %{python_module devel >= 3.6}
BuildRequires:  %{python_module setuptools}
BuildRequires:  fdupes
BuildRequires:  libheif-devel
BuildRequires:  python-rpm-macros
%if %{with test}
BuildRequires:  %{python_module Pillow >= 7.1}
BuildRequires:  %{python_module piexif}
BuildRequires:  %{python_module pytest}
%endif
%python_subpackages

%description
libheif allows conversion of HEIC format images to other formats such as JPEG. pyheif is a python wrapper for libheif

%prep
%setup -q -n pyheif-%{version}
tar xf %SOURCE1

%build
%python_build

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

%if %{with test}
%check
%pytest
%endif

%files %{python_files}
%doc README.md
%{python_sitearch}/_libheif_cffi.*.so
%{python_sitearch}/pyheif
%{python_sitearch}/pyheif-%{version}*-info

%changelog
openSUSE Build Service is sponsored by