Blame python-google-cloud-asset.spec

c0928f0
%bcond_without  tests
08934a5
08934a5
%global         srcname     google-cloud-asset
08934a5
%global         forgeurl    https://github.com/googleapis/python-asset
9a3ea5c
Version:        3.20.0
c0928f0
%global         tag         v%{version}
08934a5
%forgemeta
08934a5
08934a5
Name:           python-%{srcname}
08934a5
Release:        %autorelease
08934a5
Summary:        Python Client for Google Cloud App Engine Admin
08934a5
c0928f0
License:        Apache-2.0
08934a5
URL:            %forgeurl
08934a5
Source0:        %forgesource
08934a5
08934a5
BuildArch:      noarch
08934a5
22b8709
BuildRequires:  python3-devel
08934a5
08934a5
%if %{with tests}
08934a5
BuildRequires:  python3dist(pytest)
08934a5
BuildRequires:  python3dist(pytest-asyncio)
08934a5
%endif
08934a5
08934a5
%global _description %{expand:
08934a5
App Engine Admin allows you to manage your App Engine applications.}
08934a5
08934a5
%description %{_description}
08934a5
08934a5
08934a5
%package -n python3-%{srcname}
08934a5
Summary:        %{summary}
08934a5
08934a5
%description -n python3-%{srcname} %{_description}
08934a5
08934a5
08934a5
%prep
08934a5
%forgeautosetup -p1
08934a5
4e4eb52
# Allow a slightly older protobuf.
4e4eb52
sed -i 's/"protobuf.*",/"protobuf>=3.19.4",/' setup.py
4e4eb52
198f327
# Replace mock imports with unittest.mock.
198f327
grep -rl "^[[:space:]]*import mock" tests | \
198f327
    xargs sed -i -E 's/^([[:space:]]*)import mock/\1from unittest import mock/'
198f327
08934a5
08934a5
%generate_buildrequires
64bd149
%pyproject_buildrequires
08934a5
08934a5
08934a5
%build
08934a5
%pyproject_wheel
08934a5
08934a5
08934a5
%install
08934a5
%pyproject_install
08934a5
%pyproject_save_files google
08934a5
08934a5
# Remove extra scripts.
08934a5
rm -f %{buildroot}%{_bindir}/fixup_asset*.py
08934a5
08934a5
08934a5
%check
64bd149
%pyproject_check_import
64bd149
64bd149
%if %{with tests}
c0928f0
# NOTE(mhayden): Setting PYTHONUSERBASE as a hack for PEP 420 namespaces.
c0928f0
# Thanks to churchyard for the fix.
c0928f0
PYTHONUSERBASE=%{buildroot}%{_prefix} \
c0928f0
    %pytest tests/unit
08934a5
%endif
08934a5
08934a5
08934a5
%files -n python3-%{srcname} -f %{pyproject_files}
08934a5
%license LICENSE
08934a5
%doc README.rst CHANGELOG.md
08934a5
%{python3_sitelib}/google_cloud_asset-%{version}-py%{python3_version}-nspkg.pth
08934a5
08934a5
08934a5
%changelog
08934a5
%autochangelog