Rework the extras bcond to control the entire extras feature

This commit is contained in:
Miro Hrončok 2023-05-30 22:29:46 +02:00
parent e3db9bc24a
commit af2ab59687

View File

@ -19,16 +19,13 @@ BuildRequires: libxml2-devel
BuildRequires: libxslt-devel BuildRequires: libxslt-devel
BuildRequires: python3-devel BuildRequires: python3-devel
# It is a good idea to BuildRequire the runtime requirements of the [extras] we build. # Some of the extras create a build dependency loop.
# That way, we ensure all the [extras] we build are installable,
# and we possibly run tests that would otherwise be skipped.
# However, some of the extras here create a dependency loop.
# - [cssselect] Requires cssselect BuildRequires lxml # - [cssselect] Requires cssselect BuildRequires lxml
# - [html5] Requires html5lib BuildRequires lxml # - [html5] Requires html5lib BuildRequires lxml
# - [htmlsoup] Requires beautifulsoup4 Requires lxml # - [htmlsoup] Requires beautifulsoup4 Requires lxml
# Hence we provide a bcond to disable this buildtime requirement. # Hence we provide a bcond to disable the extras altogether.
# These subpackages are disabled outright in RHEL builds. # By default, the extras are disabled in RHEL, to avoid dependencies.
%bcond buildrequire_extras %{undefined rhel} %bcond extras %{undefined rhel}
%global _description \ %global _description \
lxml is a Pythonic, mature binding for the libxml2 and libxslt libraries. It\ lxml is a Pythonic, mature binding for the libxml2 and libxslt libraries. It\
@ -40,7 +37,7 @@ XML Schema, XSLT, C14N and much more.
%package -n python3-lxml %package -n python3-lxml
Summary: %{summary} Summary: %{summary}
%if %{undefined rhel} %if %{with extras}
Suggests: python3-lxml+cssselect Suggests: python3-lxml+cssselect
Suggests: python3-lxml+html5 Suggests: python3-lxml+html5
Suggests: python3-lxml+htmlsoup Suggests: python3-lxml+htmlsoup
@ -50,7 +47,7 @@ Suggests: python3-lxml+htmlsoup
Python 3 version. Python 3 version.
%if %{undefined rhel} %if %{with extras}
%pyproject_extras_subpkg -n python3-lxml cssselect html5 htmlsoup %pyproject_extras_subpkg -n python3-lxml cssselect html5 htmlsoup
%endif %endif
@ -58,7 +55,7 @@ Python 3 version.
%autosetup -n lxml-%{version} -p1 %autosetup -n lxml-%{version} -p1
%generate_buildrequires %generate_buildrequires
%pyproject_buildrequires -x source%{?with_buildrequire_extras:,cssselect,html5,htmlsoup} %pyproject_buildrequires -x source%{?with_extras:,cssselect,html5,htmlsoup}
# Remove pregenerated Cython C sources # Remove pregenerated Cython C sources
# We need to do this after %%pyproject_buildrequires because setup.py errors # We need to do this after %%pyproject_buildrequires because setup.py errors
# without Cython and without the .c files. # without Cython and without the .c files.