File python-kbuild.spec of Package python-kbuild

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


%if 0%{?suse_version} > 1500
%bcond_without libalternatives
%else
%bcond_with libalternatives
%endif
%{?sle15_python_module_pythons}
Name:           python-kbuild
Version:        0.0.1
Release:        0
Summary:        SUSE kbuild infrastructure
License:        FIXME-UNKNOWN
URL:            https://gitlab.suse.de/kernel/kbuild
Source:         kbuild-%{version}.tar.gz
BuildRequires:  python-rpm-macros
BuildRequires:  %{python_module pip}
BuildRequires:  %{python_module setuptools}
BuildRequires:  %{python_module wheel}
BuildRequires:  fdupes
BuildArch:      noarch
%if %{with libalternatives}
BuildRequires:  alts
Requires:       alts
%else
Requires(post): update-alternatives
Requires(postun): update-alternatives
%endif
%python_subpackages

%description
SUSE kbuild infrastructure

%prep
%autosetup -p1 -n kbuild-%{version}

%build
cd python
%pyproject_wheel

%install
cd python
%pyproject_install
%python_clone -a %{buildroot}%{_bindir}/sendmail_wrap
%python_expand %fdupes %{buildroot}%{$python_sitelib}

%pre
%python_libalternatives_reset_alternative sendmail_wrap

%post
%python_install_alternative sendmail_wrap

%postun
%python_uninstall_alternative sendmail_wrap

%files %{python_files}
%python_alternative %{_bindir}/sendmail_wrap
%{python_sitelib}/kbuild
%{python_sitelib}/kbuild-%{version}.dist-info

%changelog
openSUSE Build Service is sponsored by