Blob Blame History Raw
# tests are enabled by default
%bcond_without tests

%global         srcname     google-cloud-iam
%global         forgeurl    https://github.com/googleapis/python-iam
Version:        2.6.1
%global         tag         v%{version}
%forgemeta

Name:           python-%{srcname}
Release:        %autorelease
Summary:        Python Client for Google IAM API

License:        ASL 2.0
URL:            %forgeurl
Source0:        %forgesource
# Fix mock > unittest.mock.
# https://github.com/googleapis/python-iam/pull/97
Patch0:         python-google-cloud-iam-mock-fix.patch

BuildArch:      noarch

BuildRequires:  python3-devel

%if %{with tests}
BuildRequires:  python3-pytest
BuildRequires:  python3-pytest-asyncio
%endif

%global _description %{expand:
Manages identity and access control for Google Cloud Platform resources,
including the creation of service accounts, which you can use to authenticate
to Google and make API calls.}

%description %{_description}


%package -n python3-%{srcname}
Summary:        %{summary}

%description -n python3-%{srcname} %{_description}


%prep
%forgeautosetup -p1


%generate_buildrequires
%pyproject_buildrequires -r


%build
%pyproject_wheel


%install
%pyproject_install

# Remove unneeded executable.
rm -f %{buildroot}/%{_bindir}/fixup_iam_credentials_v1_keywords.py

%pyproject_save_files google


%if %{with tests}
%check
# Work around an usual pytest/PEP 420 issue where pytest can't import the
# installed module. Thanks to mhroncok for the help!
mv google{,_}
%pytest --disable-warnings tests/unit
mv google{_,}
%endif


%files -n python3-%{srcname} -f %{pyproject_files}
%license LICENSE
%doc README.rst CHANGELOG.md CODE_OF_CONDUCT.md CONTRIBUTING.rst SECURITY.md UPGRADING.md
%{python3_sitelib}/google_cloud_iam-%{version}-py%{python3_version}-nspkg.pth


%changelog
%autochangelog