Blame python-google-cloud-appengine-admin.spec

64cc7d5
%bcond_without  tests
a22d4b6
a22d4b6
%global         srcname     google-cloud-appengine-admin
a22d4b6
%global         forgeurl    https://github.com/googleapis/python-appengine-admin
9a317d3
Version:        1.9.3
a22d4b6
%global         tag         v%{version}
a22d4b6
%forgemeta
a22d4b6
a22d4b6
Name:           python-%{srcname}
a22d4b6
Release:        %autorelease
a22d4b6
Summary:        Python Client for Google Cloud App Engine Admin
a22d4b6
3c6ea1f
License:        Apache-2.0
a22d4b6
URL:            %forgeurl
a22d4b6
Source0:        %forgesource
a22d4b6
a22d4b6
BuildArch:      noarch
a22d4b6
65b500c
BuildRequires:  python3-devel
a22d4b6
a22d4b6
%if %{with tests}
a22d4b6
BuildRequires:  python3dist(pytest)
a22d4b6
BuildRequires:  python3dist(pytest-asyncio)
a22d4b6
%endif
a22d4b6
a22d4b6
%global _description %{expand:
a22d4b6
App Engine Admin allows you to manage your App Engine applications.}
a22d4b6
a22d4b6
%description %{_description}
a22d4b6
a22d4b6
a22d4b6
%package -n python3-%{srcname}
a22d4b6
Summary:        %{summary}
a22d4b6
a22d4b6
%description -n python3-%{srcname} %{_description}
a22d4b6
a22d4b6
a22d4b6
%prep
64cc7d5
%forgeautosetup
64cc7d5
09252ff
# Allow a slightly older protobuf.
09252ff
sed -i 's/"protobuf.*",/"protobuf>=3.19.4",/' setup.py
09252ff
64cc7d5
# Replace mock imports with unittest.mock.
64cc7d5
grep -rl "^[[:space:]]*import mock" tests | \
64cc7d5
    xargs sed -i -E 's/^([[:space:]]*)import mock/\1from unittest import mock/'
a22d4b6
a22d4b6
a22d4b6
%generate_buildrequires
a22d4b6
%pyproject_buildrequires -r
a22d4b6
a22d4b6
a22d4b6
%build
a22d4b6
%pyproject_wheel
a22d4b6
a22d4b6
a22d4b6
%install
a22d4b6
%pyproject_install
a22d4b6
%pyproject_save_files google
a22d4b6
a22d4b6
# Remove unneeded executable.
a22d4b6
rm -f %{buildroot}%{_bindir}/fixup_accessapproval_v1_keywords.py
a22d4b6
a22d4b6
a22d4b6
%check
6c3d3d1
%pyproject_check_import -e google.cloud.appengine_admin_v1.types.deployed_files
da78a4b
da78a4b
%if %{with tests}
da78a4b
# NOTE(mhayden): Setting PYTHONUSERBASE as a hack for PEP 420 namespaces.
da78a4b
# Thanks to churchyard for the fix.
da78a4b
PYTHONUSERBASE=%{buildroot}%{_prefix} \
da78a4b
    %pytest tests/unit
a22d4b6
%endif
a22d4b6
a22d4b6
a22d4b6
%files -n python3-%{srcname} -f %{pyproject_files}
a22d4b6
%doc README.rst CHANGELOG.md
a22d4b6
%{python3_sitelib}/google_cloud_appengine_admin-%{version}-py%{python3_version}-nspkg.pth
a22d4b6
a22d4b6
a22d4b6
%changelog
a22d4b6
%autochangelog