Blame python-google-cloud-org-policy.spec

81cc4d9
# The package currently has an empty test directory.
81cc4d9
%bcond_with tests
81cc4d9
81cc4d9
%global         srcname     google-cloud-org-policy
81cc4d9
%global         forgeurl    https://github.com/googleapis/python-org-policy
f09ce52
Version:        1.2.0
81cc4d9
%global         tag         v%{version}
81cc4d9
%forgemeta
81cc4d9
81cc4d9
Name:           python-%{srcname}
81cc4d9
Release:        %autorelease
81cc4d9
Summary:        Python Client for Google Cloud Organization Policy API
81cc4d9
81cc4d9
License:        ASL 2.0
81cc4d9
URL:            %forgeurl
81cc4d9
Source0:        %forgesource
81cc4d9
81cc4d9
BuildArch:      noarch
81cc4d9
81cc4d9
BuildRequires:  pyproject-rpm-macros
81cc4d9
81cc4d9
%if %{with tests}
81cc4d9
BuildRequires:  python3dist(pytest)
81cc4d9
BuildRequires:  python3dist(pytest-asyncio)
81cc4d9
%endif
81cc4d9
81cc4d9
%global _description %{expand:
81cc4d9
The Organization Policy API allows users to configure governance rules on their
81cc4d9
GCP resources across the Cloud Resource Hierarchy.}
81cc4d9
81cc4d9
%description %{_description}
81cc4d9
81cc4d9
81cc4d9
%package -n python3-%{srcname}
81cc4d9
Summary:        %{summary}
81cc4d9
81cc4d9
%description -n python3-%{srcname} %{_description}
81cc4d9
81cc4d9
81cc4d9
%package -n python3-%{srcname}-doc
81cc4d9
Requires:       python3-docs
81cc4d9
BuildRequires:  python3-docs
81cc4d9
BuildRequires:  python3dist(recommonmark)
81cc4d9
BuildRequires:  python3dist(sphinx)
81cc4d9
Summary:        Documentation for python-%{srcname}
81cc4d9
81cc4d9
%description -n python3-%{srcname}-doc
81cc4d9
Documentation for python-%{srcname}
81cc4d9
81cc4d9
81cc4d9
%prep
81cc4d9
%forgeautosetup -p1
81cc4d9
81cc4d9
81cc4d9
%generate_buildrequires
81cc4d9
%pyproject_buildrequires -r
81cc4d9
81cc4d9
81cc4d9
%build
81cc4d9
%pyproject_wheel
81cc4d9
81cc4d9
# Generate documentation.
81cc4d9
PYTHONPATH="${PWD}:${PWD}/docs/" sphinx-build docs html %{?_smp_mflags}
81cc4d9
rm -rf html/.{doctrees,buildinfo}
81cc4d9
81cc4d9
81cc4d9
%install
81cc4d9
%pyproject_install
81cc4d9
%pyproject_save_files google
81cc4d9
81cc4d9
# Remove extra scripts, docs files, and tests.
81cc4d9
rm -rf %{buildroot}%{python3_sitelib}/{docs,scripts,tests}
81cc4d9
81cc4d9
81cc4d9
%if %{with tests}
81cc4d9
%check
81cc4d9
# Work around an unusual pytest/PEP 420 issue where pytest can't import the
81cc4d9
# installed module. Thanks to mhroncok for the help!
81cc4d9
mv google{,_}
81cc4d9
%pytest --disable-warnings tests/unit
81cc4d9
mv google{_,}
81cc4d9
%endif
81cc4d9
81cc4d9
81cc4d9
%files -n python3-%{srcname} -f %{pyproject_files}
81cc4d9
%license LICENSE
81cc4d9
%doc README.rst CHANGELOG.md
81cc4d9
%{python3_sitelib}/google_cloud_org_policy-%{version}-py%{python3_version}-nspkg.pth
81cc4d9
81cc4d9
81cc4d9
%files -n python3-%{srcname}-doc
81cc4d9
%license LICENSE
81cc4d9
%doc html
81cc4d9
81cc4d9
81cc4d9
%changelog
81cc4d9
%autochangelog