File pepper.spec of Package pepper

#
# spec file for package pepper
#
# Copyright (c) 2023-2025 Georg Pfuetzenreuter <mail+rpm@georg-pfuetzenreuter.net>
#
# 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/
#


%define setupversion %(ver=%{version}; printf ${ver%%+*})
%if 0%{?suse_version} > 1600
%define pythons python313
%else
%{?sle15_python_module_pythons}
%endif
Name:           pepper
Version:        0.7.6+git44.996fc29
Release:        0
Summary:        Library and CLI to access a salt-api instance
License:        Apache-2.0
Group:          Development/Languages/Python
URL:            https://github.com/saltstack/pepper
Source:         %{name}-%{version}.tar.gz
BuildRequires:  %{python_module pip}
BuildRequires:  %{python_module setuptools}
BuildRequires:  %{python_module wheel}
BuildRequires:  %{pythons}
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
Provides:       salt-pepper
Provides:       %{python_module pepper}
BuildArch:      noarch

%description
Pepper contains a Python library and CLI scripts for accessing a remote salt-api instance.

pepperlib abstracts the HTTP calls to salt-api so existing Python projects can easily integrate with a remote Salt installation just by instantiating a class.

The pepper CLI script allows users to execute Salt commands from computers that are external to computers running the salt-master or salt-minion daemons as though they were running Salt locally.

%prep
%autosetup -p1
sed -i "s/'use_scm_version': True/'version': '%{setupversion}'/" setup.py
sed -i 's?%{_bindir}/env python?%{_bindir}/python?' pepper/script.py

%build
%pyproject_wheel

%install
%pyproject_install
%fdupes %{buildroot}%{python_sitelib}

%files
%license LICENSE
%doc README.rst
%{_bindir}/%{name}
%dir %{python_sitelib}/%{name}
%attr(0755,root,root) %{python_sitelib}/%{name}/script.py
%{python_sitelib}/%{name}/{__init__,cli,exceptions,libpepper,retcode}.py
# it installing itself as 0.0.0 seems wrong but whatever
%{python_sitelib}/salt_%{name}-0.0.0.dist-info
%pycache_only %{python_sitelib}/%{name}/__pycache__

%changelog
openSUSE Build Service is sponsored by