Blob Blame History Raw
%bcond_without  tests

# When bootstrapping, we do not include the “grpc” extra in the BR’s. That adds
# a BR on python3dist(grpcio), but this package is required by
# python3dist(grpcio-status), which creates a circular dependency with grpc.
%bcond_with bootstrap

%global         srcname     googleapis-common-protos
%global         forgeurl
Version:        1.60.0
%global         tag         v%{version}

Name:           python-%{srcname}
Release:        %autorelease
Summary:        Common protobufs used in Google APIs

License:        Apache-2.0
URL:            %forgeurl
Source0:        %forgesource

BuildArch:      noarch

BuildRequires:  python3-devel

%if %{with tests}
BuildRequires:  python3dist(pytest)

%global common_description %{expand:

%description %{common_description}

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

%description -n python3-%{srcname} %{common_description}

%pyproject_extras_subpkg -n python3-%{srcname} grpc


%pyproject_buildrequires -r %{?!with_bootstrap:-x grpc}


%pyproject_save_files google

# Upstream has no tests.
# Note that google and google.logging are namespace packages.
%pyproject_check_import %{?with_bootstrap:-e 'google.longrunning.*grpc*'}

%if %{with tests}
# NOTE(mhayden): Setting PYTHONUSERBASE as a hack for PEP 420 namespaces.
# Thanks to churchyard for the fix.
PYTHONUSERBASE=%{buildroot}%{_prefix} \
    %pytest tests/unit

%files -n python3-%{srcname} -f %{pyproject_files}
%doc README.rst