Blame python-google-cloud-access-approval.spec

6444da7
# tests are enabled by default
a79172b
%bcond_without  tests
6444da7
6444da7
%global         srcname     google-cloud-access-approval
6444da7
%global         forgeurl    https://github.com/googleapis/python-access-approval
78a1eff
Version:        1.10.1
6444da7
%global         tag         v%{version}
6444da7
%forgemeta
6444da7
6444da7
Name:           python-%{srcname}
6444da7
Release:        %autorelease
6444da7
Summary:        Python Client for Google Cloud Access Approval API
6444da7
6444da7
License:        ASL 2.0
6444da7
URL:            %forgeurl
6444da7
Source0:        %forgesource
6444da7
6444da7
BuildArch:      noarch
6444da7
6444da7
BuildRequires:  python3-devel
6444da7
6444da7
%if %{with tests}
6444da7
BuildRequires:  python3dist(pytest)
6444da7
BuildRequires:  python3dist(pytest-asyncio)
6444da7
%endif
6444da7
6444da7
%global _description %{expand:
6444da7
The Access Approval API is an API for controlling access to data by Google
6444da7
personnel.}
6444da7
6444da7
%description %{_description}
6444da7
6444da7
6444da7
%package -n python3-%{srcname}
6444da7
Summary:        %{summary}
6444da7
6444da7
%description -n python3-%{srcname} %{_description}
6444da7
6444da7
6444da7
%prep
a79172b
%forgeautosetup
a79172b
e889cb9
# Allow a slightly older protobuf.
e889cb9
sed -i 's/"protobuf.*",/"protobuf>=3.19.4",/' setup.py
e889cb9
a79172b
# Replace mock imports with unittest.mock.
a79172b
grep -rl "^[[:space:]]*import mock" tests | \
a79172b
    xargs sed -i -E 's/^([[:space:]]*)import mock/\1from unittest import mock/'
6444da7
6444da7
6444da7
%generate_buildrequires
6444da7
%pyproject_buildrequires -r
6444da7
6444da7
6444da7
%build
6444da7
%pyproject_wheel
6444da7
6444da7
6444da7
%install
6444da7
%pyproject_install
6444da7
%pyproject_save_files google
6444da7
6444da7
# Remove unneeded executable.
6444da7
rm -f %{buildroot}%{_bindir}/fixup_accessapproval_v1_keywords.py
6444da7
6444da7
6444da7
%check
47df630
%pyproject_check_import
47df630
47df630
%if %{with tests}
6444da7
# Work around an usual pytest/PEP 420 issue where pytest can't import the
6444da7
# installed module. Thanks to mhroncok for the help!
6444da7
mv google{,_}
6444da7
%pytest --disable-warnings tests/unit
6444da7
mv google{_,}
6444da7
%endif
6444da7
6444da7
6444da7
6444da7
%files -n python3-%{srcname} -f %{pyproject_files}
6444da7
%license LICENSE
6444da7
%doc README.rst CHANGELOG.md
6444da7
%{python3_sitelib}/google_cloud_access_approval-%{version}-py%{python3_version}-nspkg.pth
6444da7
6444da7
6444da7
%changelog
6444da7
%autochangelog