From a22da235f542388326b9ceb88d4ad45e77e17473 Mon Sep 17 00:00:00 2001 From: Miro HronĨok Date: Feb 16 2024 10:01:15 +0000 Subject: Make it possible to bootstrap this package, use %bconds --- diff --git a/python-oslo-config.spec b/python-oslo-config.spec index 5878d95..fc5fc70 100644 --- a/python-oslo-config.spec +++ b/python-oslo-config.spec @@ -2,18 +2,21 @@ %global sources_gpg_sign 0x815afec729392386480e076dcc0dfe2d21c023c9 %global sname oslo.config %global pypi_name oslo-config -%global with_doc 1 +# doc and tests are enabled by default unless %%repo_bootstrap +%bcond doc %[!0%{?repo_bootstrap}] +%bcond tests %[!0%{?repo_bootstrap}] %{!?upstream_version: %global upstream_version %{version}%{?milestone}} # we are excluding some BRs from automatic generator %global excluded_brs doc8 bandit pre-commit hacking flake8-import-order +%if %{without doc} # Exclude sphinx from BRs if docs are disabled -%if ! 0%{?with_doc} %global excluded_brs %{excluded_brs} sphinx openstackdocstheme -%endif -%if 0%{?repo_bootsrap} +%if %{without tests} +# Exclude oslo.log from BRs if docs and tests are disabled %global excluded_brs %{excluded_brs} oslo.log %endif +%endif Name: python-oslo-config Epoch: 2 @@ -64,7 +67,7 @@ useful. The oslo-config library is a command line and configuration file parsing library from the Oslo project. -%if 0%{?with_doc} +%if %{with doc} %package -n python-%{pypi_name}-doc Summary: Documentation for OpenStack common configuration library @@ -82,7 +85,7 @@ Documentation for the oslo-config library. sed -i '/\/usr\/bin\/env/d' oslo_config/validator.py # Remove tests requiring sphinx if sphinx is not available -%if 0%{?with_doc} == 0 +%if %{with doc} == 0 rm oslo_config/tests/test_sphinxext.py rm oslo_config/tests/test_sphinxconfiggen.py %endif @@ -103,16 +106,12 @@ done # Automatic BR generation %generate_buildrequires -%if 0%{?with_doc} - %pyproject_buildrequires -t -e %{default_toxenv},docs -%else - %pyproject_buildrequires -t -e %{default_toxenv} -%endif +%pyproject_buildrequires %{?with_doc:-e docs} %{?with_tests:-e %{default_toxenv}} %build %pyproject_wheel -%if 0%{?with_doc} +%if %{with doc} %tox -e docs # remove the sphinx-build-3 leftovers rm -rf doc/build/html/.{doctrees,buildinfo} @@ -128,7 +127,7 @@ done popd %check -%if 0%{?repo_bootstrap} == 0 +%if %{with tests} %tox -e %{default_toxenv} %endif @@ -142,7 +141,7 @@ popd %{python3_sitelib}/oslo_config %{python3_sitelib}/*.dist-info -%if 0%{?with_doc} +%if %{with doc} %files -n python-%{pypi_name}-doc %doc doc/build/html %license LICENSE