File saltbundlepy-libvirt.spec of Package saltbundlepy-libvirt

#
# spec file for package saltbundlepy-libvirt
#
# Copyright (c) 2025 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/
#


%{?!saltbundlepy_module:%define saltbundlepy_module() saltbundlepy-%{**}}
%define pythons saltbundlepy

# Disable python bytecompile for all distros
# It's called explicitly in the spec
%global __brp_python_bytecompile %{nil}

%define srcname libvirt-python

Name:           saltbundlepy-libvirt
URL:            https://libvirt.org/
Version:        11.2.0
Release:        0
Summary:        Library providing a virtualization API
License:        LGPL-2.1-or-later
Group:          Development/Languages/Python
Source0:        %{srcname}-%{version}.tar.gz
BuildRequires:  fdupes
BuildRequires:  pkgconfig
%if "%_vendor" == "debbuild"
BuildRequires:  libvirt-dev
%else
BuildRequires:  libvirt-devel
%endif
BuildRequires:  saltbundlepy-rpm-macros
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  %{saltbundlepy_module devel >= 3.11}
BuildRequires:  %{saltbundlepy_module lxml}
BuildRequires:  %{saltbundlepy_module pytest}
BuildRequires:  %{saltbundlepy_module xml}
%python_subpackages

%description
The python-libvirt-python package contains a module that permits applications
written in the Python programming language to use the interface
supplied by the libvirt library to use the virtualization capabilities
of recent versions of Linux (v2.6.20+).

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

# Unset execute bit for example scripts; it can introduce spurious
# RPM dependencies, like /usr/bin/python which can pull in python2
# for the -python3 package
find examples -type f -exec chmod 0644 \{\} \;

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

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

%check
%if 0%{?sle_version} && 0%{?sle_version} < 150000
%{pytest_arch -k 'not testEventsPreInitExplicit and not testEventsWithAsyncioRun and not testEventsWithManualLoopSetup'}
%else
%{pytest_arch}
%endif

%files %{python_files}
%doc README COPYING examples/
%{python_sitearch}/libvirt*
%{python_sitearch}/libvirt_python-%{version}*info
%pycache_only %{python_sitearch}/__pycache__/libvirt*

%changelog
openSUSE Build Service is sponsored by