File python-bluepy.spec of Package python-bluepy

#
# spec file for package python-bluepy
#
# Copyright (c) 2023 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/
#


%define skip_python2 1
%define skip_python36 1
%bcond_with test
Name:           python-bluepy
Version:        1.3.0
Release:        0
Summary:        Python interface to Bluetooth LE on Linux
# according to LICENSE.txt:
# - bluez-x.yz is under GPLv2 & LGPLv2
# - everything else is public domain
License:        GPL-2.0-or-later AND LGPL-2.1-or-later AND SUSE-Public-Domain
URL:            https://ianharvey.github.io/bluepy-doc/
Source:         bluepy-%{version}.tar.xz
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module setuptools}
BuildRequires:  fdupes
BuildRequires:  glib2-devel
BuildRequires:  python-rpm-macros
BuildRequires:  unzip
%if %{with test}
BuildRequires:  %{python_module pytest}
%endif
%python_subpackages

%description
Bluepy is a Python package to allow Bluetooth Low Energy (a.k.a Bluetooth
Smart) peripherals to be controlled from Python. Installation instructions
and release notes are in the file README.md.

Source code and further documentation is at:
  https://github.com/IanHarvey/bluepy
  http://ianharvey.github.io/bluepy-doc/

%prep
%setup -q -n bluepy-%{version}

%build
%python_build

%install
%python_install
%fdupes %{buildroot}%{_prefix}
%python_clone -a %{buildroot}%{_bindir}/blescan
%python_clone -a %{buildroot}%{_bindir}/sensortag
%python_clone -a %{buildroot}%{_bindir}/thingy52

%if %{with test}
%check
sed -i -e "s/'coveralls'/'python-coveralls'/" setup.py
%{python_expand virtualenv-%$python_bin_suffix --system-site-packages --no-download testvenv-%$python_bin_suffix
testvenv-%$python_bin_suffix/bin/pip install -e .[test,build]
export PYTHONPATH=$PWD/testvenv-%$python_bin_suffix/lib/python%$python_bin_suffix/site-packages/:$PWD
testvenv-%$python_bin_suffix/bin/python -m pytest && rm -Rf testvenv-%$python_bin_suffix
}
%endif

%files %{python_files}
%license LICENSE.txt
%doc README README.md
%python_alternative %{_bindir}/blescan
%python_alternative %{_bindir}/sensortag
%python_alternative %{_bindir}/thingy52
%{python_sitelib}/bluepy
%{python_sitelib}/bluepy-%{version}*-info

%changelog
openSUSE Build Service is sponsored by