Blame python-google-cloud-build.spec

865afe2
%bcond_without  tests
9e5a8da
9e5a8da
%global         srcname     google-cloud-build
9e5a8da
%global         forgeurl    https://github.com/googleapis/python-cloudbuild
85d10db
Version:        3.16.0
9e5a8da
%global         tag         v%{version}
9e5a8da
%forgemeta
9e5a8da
9e5a8da
Name:           python-%{srcname}
f5bc6a8
Release:        %autorelease
9e5a8da
Summary:        Python Client for Google Cloud Build API
9e5a8da
75a2198
License:        Apache-2.0
9e5a8da
URL:            %forgeurl
9e5a8da
Source0:        %forgesource
9e5a8da
9e5a8da
BuildArch:      noarch
9e5a8da
9e5a8da
BuildRequires:  python3-devel
9e5a8da
9e5a8da
%if %{with tests}
9e5a8da
BuildRequires:  python3dist(pytest)
9e5a8da
BuildRequires:  python3dist(pytest-asyncio)
9e5a8da
%endif
9e5a8da
9e5a8da
%global _description %{expand:
9e5a8da
Creates and manages builds on Google Cloud Platform.}
9e5a8da
9e5a8da
%description %{_description}
9e5a8da
9e5a8da
9e5a8da
%package -n python3-%{srcname}
9e5a8da
Summary:        %{summary}
9e5a8da
%description -n python3-%{srcname} %{_description}
9e5a8da
9e5a8da
9e5a8da
%prep
0822c79
%forgeautosetup -p1
9e5a8da
77c2514
# Allow a slightly older protobuf.
77c2514
sed -i 's/"protobuf.*",/"protobuf>=3.19.4",/' setup.py
77c2514
865afe2
# Replace mock imports with unittest.mock.
865afe2
grep -rl "^[[:space:]]*import mock" tests | \
865afe2
    xargs sed -i -E 's/^([[:space:]]*)import mock/\1from unittest import mock/'
865afe2
9e5a8da
9e5a8da
%generate_buildrequires
9e5a8da
%pyproject_buildrequires -r
9e5a8da
9e5a8da
9e5a8da
%build
9e5a8da
%pyproject_wheel
9e5a8da
9e5a8da
9e5a8da
%install
9e5a8da
%pyproject_install
9e5a8da
%pyproject_save_files google
9e5a8da
9e5a8da
# Remove unnecessary script.
9e5a8da
rm -f %{buildroot}%{_bindir}/fixup_cloudbuild*.py
9e5a8da
9e5a8da
9e5a8da
%check
75a2198
%pyproject_check_import -e 'google.cloud.devtools.cloudbuild_v2*'
75a2198
75a2198
%if %{with tests}
75a2198
# NOTE(mhayden): Setting PYTHONUSERBASE as a hack for PEP 420 namespaces.
75a2198
# Thanks to churchyard for the fix.
75a2198
PYTHONUSERBASE=%{buildroot}%{_prefix} \
75a2198
    %pytest tests/unit
9e5a8da
%endif
9e5a8da
9e5a8da
9e5a8da
%files -n python3-%{srcname} -f %{pyproject_files}
9e5a8da
%license LICENSE
9e5a8da
%doc README.rst CHANGELOG.md
9e5a8da
%{python3_sitelib}/google_cloud_build-%{version}-py%{python3_version}-nspkg.pth
9e5a8da
9e5a8da
9e5a8da
%changelog
f5bc6a8
%autochangelog