Blame python-google-cloud-pubsub.spec

a77960d
%bcond_without  tests
dc183b0
dc183b0
%global         srcname     google-cloud-pubsub
dc183b0
%global         forgeurl    https://github.com/googleapis/python-pubsub
a77960d
Version:        2.14.1
dc183b0
%global         tag         v%{version}
dc183b0
%forgemeta
dc183b0
dc183b0
Name:           python-%{srcname}
dc183b0
Release:        %autorelease
dc183b0
Summary:        Google Cloud Pub/Sub API client library
dc183b0
a77960d
License:        Apache-2.0
dc183b0
URL:            %forgeurl
dc183b0
Source0:        %forgesource
dc183b0
dc183b0
BuildArch:      noarch
dc183b0
dc183b0
BuildRequires:  python3-devel
dc183b0
dc183b0
%if %{with tests}
dc183b0
BuildRequires:  python3dist(pytest)
dc183b0
%endif
dc183b0
dc183b0
%global _description %{expand:
dc183b0
Google Cloud Pub/Sub API client library.}
dc183b0
dc183b0
%description %{_description}
dc183b0
dc183b0
dc183b0
%package -n python3-%{srcname}
dc183b0
Summary:        %{summary}
dc183b0
dc183b0
%description -n python3-%{srcname} %{_description}
dc183b0
dc183b0
# Build the libcst extras subpackage.
dc183b0
%pyproject_extras_subpkg -n python3-%{srcname} libcst
dc183b0
dc183b0
dc183b0
%prep
dc183b0
%forgeautosetup
dc183b0
dc183b0
# Replace mock imports with unittest.mock.
dc183b0
# PR opened upstream: https://github.com/googleapis/python-pubsub/pull/702
dc183b0
grep -rl "^[[:space:]]*import mock" tests | \
dc183b0
    xargs sed -i -E 's/^([[:space:]]*)import mock/\1from unittest import mock/'
dc183b0
dc183b0
dc183b0
%generate_buildrequires
dc183b0
%pyproject_buildrequires
dc183b0
dc183b0
dc183b0
%build
dc183b0
%pyproject_wheel
dc183b0
dc183b0
dc183b0
%install
dc183b0
%pyproject_install
dc183b0
%pyproject_save_files google
dc183b0
dc183b0
# Remove unnecessary script.
dc183b0
rm -f %{buildroot}%{_bindir}/fixup_pubsub_v1_keywords.py
dc183b0
dc183b0
dc183b0
%check
a77960d
%pyproject_check_import
a77960d
a77960d
%if %{with tests}
a77960d
# NOTE(mhayden): Setting PYTHONUSERBASE as a hack for PEP 420 namespaces.
a77960d
# Thanks to churchyard for the fix.
a77960d
PYTHONUSERBASE=%{buildroot}%{_prefix} \
a77960d
    %pytest tests/unit
dc183b0
%endif
dc183b0
dc183b0
dc183b0
%files -n python3-%{srcname} -f %{pyproject_files}
dc183b0
%doc CHANGELOG.md CODE_OF_CONDUCT.md README.rst SECURITY.md
dc183b0
%{python3_sitelib}/google_cloud_pubsub-%{version}-py%{python3_version}-nspkg.pth
dc183b0
dc183b0
dc183b0
%changelog
dc183b0
%autochangelog