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

%global         srcname     google-cloud-iam
%global         forgeurl
Version:        2.4.0
%global         tag         v%{version}

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

License:        ASL 2.0
URL:            %forgeurl
Source0:        %forgesource
# Fix mock > unittest.mock.
Patch0:         python-google-cloud-iam-mock-fix.patch

BuildArch:      noarch

BuildRequires:  python3-devel
BuildRequires:  pyproject-rpm-macros

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

%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}

%package -n python3-%{srcname}-doc
Requires:       python3-docs
BuildRequires:  python3-docs
BuildRequires:  python3dist(recommonmark)
BuildRequires:  python3dist(sphinx)
BuildRequires:  python3dist(sphinx-rtd-theme)
Summary:        Documentation for python-%{srcname}

%description -n python3-%{srcname}-doc
Documentation for python-%{srcname}

%patch0 -p0

# Use local inventory in intersphinx mapping.
sed -r -i -e \
    's||/%{_docdir}/python3-docs/html|' \

%pyproject_buildrequires -r


# Generate documentation.
PYTHONPATH="${PWD}:${PWD}/docs/" sphinx-build docs html
rm -rf html/.{doctrees,buildinfo} html/objects.inv


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

%pyproject_save_files google

%if %{with tests}
# 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{_,}

%files -n python3-%{srcname} -f %{pyproject_files}
%license LICENSE

%files -n python3-%{srcname}-doc
%license LICENSE
%doc html