3604ee9
%global pypi_name pure-protobuf
3604ee9
3604ee9
Name:           python-%{pypi_name}
b2a5986
Version:        2.0.1
59f46b2
Release:        %autorelease
3604ee9
Summary:        Python implementation of Protocol Buffers data types with dataclasses support
3604ee9
be29207
License:        MIT
3604ee9
URL:            https://github.com/eigenein/protobuf
3604ee9
3604ee9
# Using github sources since tests not available on PyPI
3604ee9
Source0:        %{url}/archive/%{version}/%{name}-%{version}.tar.gz
3604ee9
3604ee9
BuildArch:      noarch
3604ee9
b2a5986
BuildRequires:  python3-devel
3604ee9
BuildRequires:  python3dist(pytest)
3604ee9
BuildRequires:  python3dist(setuptools)
539b74b
%if 0%{?el8}
b2a5986
BuildRequires:  python3dist(dataclasses)
b2a5986
%endif
3604ee9
3604ee9
%global _description %{expand:
3604ee9
pure-protobuf allows you to take advantages of the standard dataclasses module
3604ee9
to define message types. It is preferred over the legacy interface for new
3604ee9
projects. The dataclasses interface is available in Python 3.6 and higher.
3604ee9
3604ee9
The legacy interface is deprecated and still available via pure_protobuf.legacy.
3604ee9
3604ee9
This guide describes how to use pure-protobuf to structure your data. It tries
3604ee9
to follow the standard developer guide. It also assumes that you're familiar
3604ee9
with Protocol Buffers.}
3604ee9
3604ee9
%description %{_description}
3604ee9
3604ee9
3604ee9
%package -n     python3-%{pypi_name}
3604ee9
Summary:        %{summary}
3604ee9
%{?python_provide:%python_provide python3-%{pypi_name}}
3604ee9
3604ee9
%description -n python3-%{pypi_name} %{_description}
3604ee9
3604ee9
3604ee9
%prep
3604ee9
%autosetup -n protobuf-%{version}
3604ee9
3604ee9
# Remove bundled egg-info
3604ee9
rm -rf %{pypi_name}.egg-info
3604ee9
3604ee9
# Fix shebangs
3604ee9
pushd pure_protobuf
3604ee9
sed -i 's|/usr/bin/env python3|%{_bindir}/python3|' \
3604ee9
    __init__.py dataclasses_.py
3604ee9
popd
3604ee9
3604ee9
3604ee9
%build
3604ee9
%py3_build
3604ee9
3604ee9
3604ee9
%install
3604ee9
%py3_install
3604ee9
3604ee9
# E: non-executable-script
3604ee9
pushd %{buildroot}%{python3_sitelib}/pure_protobuf/
3604ee9
chmod +x __init__.py dataclasses_.py
3604ee9
popd
3604ee9
3604ee9
3604ee9
%check
3604ee9
%{python3} -m pytest -v
3604ee9
3604ee9
3604ee9
%files -n python3-%{pypi_name}
3604ee9
%license LICENSE
3604ee9
%doc README.md
3604ee9
%{python3_sitelib}/pure_protobuf-%{version}-py*.egg-info
3604ee9
%{python3_sitelib}/pure_protobuf/
3604ee9
3604ee9
3604ee9
%changelog
59f46b2
%autochangelog