File python-kiwi_stackbuild_plugin.spec of Package python-kiwi_stackbuild_plugin
#
# spec file for package kiwi_stackbuild_plugin
#
# Copyright (c) 2020 SUSE Software Solutions Germany 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:
#
# https://github.com/OSInside/kiwi-stackbuild-plugin/issues
#
# If they aren't provided by a system installed macro, define them
%{!?_defaultdocdir: %global _defaultdocdir %{_datadir}/doc}
%if 0%{?suse_version} && 0%{?suse_version} < 1600
%global __python3 /usr/bin/python3.11
%global python3_pkgversion 311
%else
%{!?__python3: %global __python3 /usr/bin/python3}
%{!?python3_pkgversion:%global python3_pkgversion 3}
%endif
%if %{undefined python3_sitelib}
%if "%{_vendor}" == "debbuild"
%global python3_sitelib %(%{__python3} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
%else
%global python3_sitelib %(%{__python3} -c "import sysconfig; print(sysconfig.get_path('platlib'))")
%endif
%endif
%if %{undefined python3_version}
%global python3_version %(%{__python3} -Esc "import sys; sys.stdout.write('{0.major}.{0.minor}'.format(sys.version_info))")
%endif
%if %{undefined python3_version_nodots}
%global python3_version_nodots %(%{__python3} -Esc "import sys; sys.stdout.write('{0.major}{0.minor}'.format(sys.version_info))")
%endif
%if 0%{?debian} || 0%{?ubuntu}
%global is_deb 1
%global pygroup python
%global sysgroup admin
%global develsuffix dev
%else
%global pygroup Development/Languages/Python
%global sysgroup System/Management
%global develsuffix devel
%endif
Name: python-kiwi_stackbuild_plugin
Version: 1.0.11
Release: 0
Url: https://github.com/OSInside/kiwi-stackbuild-plugin
Summary: KIWI - Stack Build Plugin
License: GPL-3.0-or-later
%if "%{_vendor}" == "debbuild"
# Needed to set Maintainer in output debs
Packager: Marcus Schaefer <marcus.schaefer@suse.de>
%endif
Group: %{pygroup}
Source: python-kiwi-stackbuild-plugin.tar.gz
Source1: %{name}-rpmlintrc
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: python%{python3_pkgversion}-%{develsuffix}
BuildRequires: python%{python3_pkgversion}-build
BuildRequires: python%{python3_pkgversion}-installer
BuildRequires: python%{python3_pkgversion}-poetry-core >= 1.2.0
BuildRequires: python%{python3_pkgversion}-wheel
# doc build requirements
%if ! (0%{?fedora} >= 41 || 0%{?rhel} >= 10)
BuildRequires: python%{python3_pkgversion}-docopt >= 0.6.2
%else
BuildRequires: python%{python3_pkgversion}-docopt-ng
%endif
%if 0%{?suse_version}
BuildRequires: python%{python3_pkgversion}-Sphinx
%else
BuildRequires: python%{python3_pkgversion}-sphinx
%endif
%if 0%{?debian} || 0%{?ubuntu}
BuildRequires: python%{python3_pkgversion}-sphinx-rtd-theme
%else
BuildRequires: python%{python3_pkgversion}-sphinx_rtd_theme
%endif
%if 0%{?fedora} || 0%{?suse_version}
BuildRequires: fdupes
%endif
BuildArch: noarch
%description
KIWI plugin to build images using a container layer as the rootfs
origin. This allows to build an image on top of a non empty
image root directory
# python3-kiwi_stackbuild_plugin
%package -n python%{python3_pkgversion}-kiwi_stackbuild_plugin
Summary: KIWI - Stack Build Plugin
Group: Development/Languages/Python
Requires: python%{python3_pkgversion} >= 3.9
Requires: python%{python3_pkgversion}-docopt
Requires: python%{python3_pkgversion}-kiwi >= 9.21.21
%description -n python%{python3_pkgversion}-kiwi_stackbuild_plugin
KIWI plugin to build images using a container layer as the rootfs
origin. This allows to build an image on top of a non empty
image root directory
%prep
%setup -q -n kiwi_stackbuild_plugin-%{version}
# Temporarily switch things back to docopt for everything but Fedora 41+
# FIXME: Drop this hack as soon as we can...
%if ! (0%{?fedora} >= 41 || 0%{?rhel} >= 10)
sed -e 's/docopt-ng.*/docopt = ">=0.6.2"/' -i pyproject.toml
%endif
# Build documentation
make -C doc man
# Build application wheel
%{__python3} -m build --no-isolation --wheel
%install
# Install plugin
%{__python3} -m installer --destdir %{buildroot} %{?is_deb:--no-compile-bytecode} dist/*.whl
%if 0%{?is_deb}
# Fix where files were installed
mv %{buildroot}%{_prefix}/local/* %{buildroot}%{_prefix}
mv %{buildroot}%{_prefix}/lib/python3* %{buildroot}%{_prefix}/lib/python3
%endif
# Install man pages and package documentation
make buildroot=%{buildroot}/ docdir=%{_defaultdocdir}/ install
%files -n python%{python3_pkgversion}-kiwi_stackbuild_plugin
%dir %{_defaultdocdir}/python-kiwi_stackbuild_plugin
%{python3_sitelib}/kiwi_stackbuild_plugin*
%{_defaultdocdir}/python-kiwi_stackbuild_plugin/LICENSE
%{_defaultdocdir}/python-kiwi_stackbuild_plugin/README
%doc %{_mandir}/man8/*
%changelog