## START: Set by rpmautospec
## (rpmautospec version 0.7.2)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 1;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

%global         pypi_name       protobuf

Version:        5.28.2

Name:           python-%{pypi_name}
Release:        %autorelease
Summary:        Serialize structured data

License:        BSD-3-Clause
URL:            https://protobuf.dev
VCS:            git:https://github.com/protocolbuffers/protobuf.git
Source:         %{pypi_source %pypi_name}

BuildRequires:  gcc
BuildRequires:  python3-devel
BuildRequires:  python3-pytest

%global _description %{expand:
Protocol buffers are Google’s language-neutral,
platform-neutral, extensible mechanism for serializing
structured data – think XML, but smaller, faster, and
simpler. You define how you want your data to be
structured once, then you can use special generated
source code to easily write and read your structured
data to and from a variety of data streams and using
a variety of languages.}

%description %_description

%package -n python3-%{pypi_name}
Summary:        %{summary}

%description -n python3-%{pypi_name} %_description


%prep
%autosetup -n %{pypi_name}-%{version}

%generate_buildrequires
%pyproject_buildrequires


%build
%pyproject_wheel

%install
%pyproject_install
# Uses google.protobuf but the macro does not support
# namespaced packages with a dot
# https://bugzilla.redhat.com/show_bug.cgi?id=1935266
# list files directly
%pyproject_save_files -l google

%check
# No tests shipped with sources on PyPI
%pyproject_check_import

%files -n python3-%{pypi_name} -f %{pyproject_files}
%doc README.md
%{python3_sitearch}/%{pypi_name}-%{version}-py%{python3_version}-nspkg.pth

%changelog
## START: Generated by rpmautospec
* Tue Oct 22 2024 John Doe <packager@example.com> - 5.28.2-1
- Uncommitted changes
## END: Generated by rpmautospec