File saltbundlepy-kiwi.spec of Package saltbundlepy-kiwi

#
# spec file for package saltbundlepy-kiwi
#
# Copyright (c) 2021 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}

# If they aren't provided by a system installed macro, define them
%{!?_defaultdocdir: %global _defaultdocdir %{_datadir}/doc}

Name:           saltbundlepy-kiwi
Version:        9.23.20
Release:        0
URL:            https://github.com/OSInside/kiwi
Summary:        KIWI - Appliance Builder Next Generation
License:        GPL-3.0-or-later
Group:          Development/Languages/Python
Source:         python-kiwi.tar.gz
Source1:        %{name}-rpmlintrc
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  %{saltbundlepy_module setuptools}
BuildRequires:  fdupes
BuildRequires:  saltbundlepy-rpm-macros
Requires:       saltbundlepy-docopt
Requires:       saltbundlepy-lxml
Requires:       saltbundlepy-pyxattr
Requires:       saltbundlepy-pyyaml
Requires:       saltbundlepy-requests
Requires:       saltbundlepy-setuptools
BuildArch:      noarch
%python_subpackages

%description
The KIWI Image System provides an operating system image builder
for Linux supported hardware platforms as well as for virtualization
and cloud systems like Xen, KVM, VMware, EC2 and more.

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

# Drop shebang for kiwi/xml_parse.py, as we don't intend to use it
# as an independent script
sed -e "s|#!/usr/bin/env python||" -i kiwi/xml_parse.py

%build
# Build C-Tools
make CFLAGS="${RPM_OPT_FLAGS}" tools

%install
# Install Python 3 version
%{python_expand \
$python setup.py install --prefix=%{_prefix} --root=%{buildroot}
$python -m compileall -d %{$python_sitelib} %{buildroot}%{$python_sitelib}
$python -O -m compileall -d %{$python_sitelib} %{buildroot}%{$python_sitelib}
%fdupes -s %{buildroot}%{$python_sitelib}
}

%python_clone -a %{buildroot}%{_bindir}/kiwi-ng
%python_clone -a %{buildroot}%{_bindir}/kiwicompat

%post
%python_install_alternative kiwi-ng
%python_install_alternative kiwicompat

%postun
%python_uninstall_alternative kiwi-ng
%python_uninstall_alternative kiwicompat

%files %{python_files}
%{_bindir}/kiwi*
%{python_sitelib}/kiwi*
%ghost %_sysconfdir/alternatives/kiwi-ng
%ghost %_sysconfdir/alternatives/kiwicompat

%changelog
openSUSE Build Service is sponsored by