File python-mypy-protobuf.spec of Package python-mypy-protobuf

#
# spec file for package python-mypy-protobuf
#
# Copyright (c) 2022 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/
#


%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
%define skip_python36 1
Name:           python-mypy-protobuf
Version:        3.2.0
Release:        0
Summary:        Generate mypy stub files from protobuf specs
License:        MIT
URL:            https://github.com/nipunn1313/mypy-protobuf
Source:         https://github.com/nipunn1313/mypy-protobuf/archive/refs/tags/v%{version}.tar.gz#/mypy-protobuf-%{version}.tar.gz
BuildRequires:  %{python_module mypy}
BuildRequires:  %{python_module grpcio}
BuildRequires:  %{python_module pip}
BuildRequires:  %{python_module protobuf >= 3.19.4}
BuildRequires:  %{python_module pytest}
BuildRequires:  %{python_module setuptools}
BuildRequires:  %{python_module wheel}
BuildRequires:  %{pythons}
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
Requires:       python-protobuf
BuildArch:      noarch
Requires(post):   update-alternatives
Requires(postun): update-alternatives
%python_subpackages

%description
Generate mypy stub files from protobuf specs.

%prep
%autosetup -p1 -n mypy-protobuf-%{version}

%build
%pyproject_wheel

%install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%python_clone -a %{buildroot}%{_bindir}/protoc-gen-mypy
%python_clone -a %{buildroot}%{_bindir}/protoc-gen-mypy_grpc

%post
%{python_install_alternative protoc-gen-mypy protoc-gen-mypy_grpc}

%postun
%{python_uninstall_alternative protoc-gen-mypy protoc-gen-mypy_grpc}

%check
export PATH=%{buildroot}/%{_bindir}:$PATH
%{python_expand #
export PYTHONPATH=%{buildroot}%{$python_sitelib}
protoc-gen-mypy-%{$python_bin_suffix} -V
}

%files %{python_files}
%doc README.md
%license LICENSE
%python_alternative %{_bindir}/protoc-gen-mypy
%python_alternative %{_bindir}/protoc-gen-mypy_grpc
%{python_sitelib}/mypy_protobuf
%{python_sitelib}/mypy_protobuf-%{version}*-info

%changelog
openSUSE Build Service is sponsored by