File python-kube-hunter.spec of Package python-kube-hunter

#
# spec file for package python-kube-hunter
#
# Copyright (c) 2024 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/
#


Name:           python-kube-hunter
Version:        0.6.8
Release:        0
Summary:        Kubernetes security weaknesses hunter for humans
License:        Apache-2.0
URL:            https://github.com/aquasecurity/kube-hunter
Source:         https://files.pythonhosted.org/packages/source/k/kube-hunter/kube-hunter-%{version}.tar.gz
BuildRequires:  python-rpm-macros
BuildRequires:  %{python_module pip}
BuildRequires:  %{python_module setuptools}
BuildRequires:  %{python_module setuptools >= 30.3.0}
BuildRequires:  %{python_module setuptools_scm}
BuildRequires:  %{python_module wheel}

# https://github.com/aquasecurity/kube-hunter/blob/main/setup.cfg#L32
BuildRequires:  %{python_module netaddr}
BuildRequires:  %{python_module pyroute2}
BuildRequires:  %{python_module requests}
BuildRequires:  %{python_module PrettyTable}
BuildRequires:  %{python_module urllib3 >= 1.24.3}
BuildRequires:  %{python_module ruamel.yaml}
# future no longer required on python3
BuildRequires:  %{python_module packaging}
# dataclasses is included in Python3.7 or higher
BuildRequires:  %{python_module pluggy}
BuildRequires:  %{python_module kubernetes >= 12.0.1}
# SECTION test requirements
BuildRequires:  %{python_module pytest}
BuildRequires:  %{python_module netifaces}
BuildRequires:  %{python_module requests-mock}
BuildRequires:  %{python_module PyInstaller}
BuildRequires:  %{python_module twine}
# /SECTION
BuildRequires:  fdupes
Requires(post): update-alternatives
Requires(postun):update-alternatives
Requires:       python-dataclasses
Requires:       python-future
Requires:       python-kubernetes >= 12.0.1
Requires:       python-netaddr
Requires:       python-netifaces
Requires:       python-packaging
Requires:       python-pluggy
Requires:       python-PrettyTable
Requires:       python-requests
Requires:       python-ruamel.yaml
Requires:       python-urllib3 >= 1.24.3
BuildArch:      noarch
%python_subpackages

%description
Kubernetes security weaknesses hunter for humans

%prep
%autosetup -p1 -n kube-hunter-%{version}

%build
%pyproject_wheel

%install
%pyproject_install
%python_clone -a %{buildroot}%{_bindir}/kube-hunter
%python_expand sed -i '1d' %{buildroot}%{$python_sitelib}/kube_hunter/__main__.py
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%python_expand rm -rf %{buildroot}%{$python_sitelib}/tests

%check
sed -i '/addopts/d' setup.cfg
echo "pytest fails with ModuleNotFoundError: No module named 'tests.plugins'"

%post
%python_install_alternative kube-hunter

%postun
%python_uninstall_alternative kube-hunter

%files %{python_files}
%doc README.md
%license LICENSE
%python_alternative %{_bindir}/kube-hunter
%{python_sitelib}/kube_hunter
%{python_sitelib}/kube_hunter-%{version}.dist-info

%changelog
openSUSE Build Service is sponsored by